Skip to content

Commit

Permalink
config: platform dependent user attributes
Browse files Browse the repository at this point in the history
This introduces verbiage of fields that may occur in json (technically
optional), but is required on certain platforms (e.g. Linux).

Not adding a "name" string, as that is not a requirement yet.

In the event a windows runtime shows up, I could imagine an `sid`, but
we'll get to that when it happens.

Closes opencontainers#135
Related to opencontainers#166

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
  • Loading branch information
vbatts committed Jan 13, 2016
1 parent 52cbf47 commit a23a5c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
11 changes: 11 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ type Process struct {
Cwd string `json:"cwd"`
}

// User specifies linux specific user and group information for the container's
// main process.
type User struct {
// UID is the user ID the Process is executed as. (this field is platform dependent)
UID uint32 `json:"uid,omitempty"`
// GID is the group ID the Process is executed as. (this field is platform dependent)
GID uint32 `json:"gid,omitempty"`
// AdditionalGids are additional group ids set for the container's process. (this field is platform dependent)
AdditionalGids []uint32 `json:"additionalGids,omitempty"`
}

// Root contains information about the container's root filesystem on the host.
type Root struct {
// Path is the absolute path to the container's root filesystem.
Expand Down
6 changes: 3 additions & 3 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ The runtime MUST mount entries in the listed order.
The user for the process is a platform-specific structure that allows specific control over which user the process runs as.
For Linux-based systems the user structure has the following fields:

* **`uid`** (int, required) specifies the user id.
* **`gid`** (int, required) specifies the group id.
* **`additionalGids`** (array of ints, optional) specifies additional group ids to be added to the process.
* **`uid`** (int, required on Linux) specifies the user id.
* **`gid`** (int, required on Linux) specifies the group id.
* **`additionalGids`** (array of ints, optional on Linux) specifies additional group ids to be added to the process.

*Example (Linux)*

Expand Down
11 changes: 0 additions & 11 deletions config_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,3 @@ type Linux struct {
// Capabilities are linux capabilities that are kept for the container.
Capabilities []string `json:"capabilities"`
}

// User specifies linux specific user and group information for the container's
// main process.
type User struct {
// UID is the user id.
UID uint32 `json:"uid"`
// GID is the group id.
GID uint32 `json:"gid"`
// AdditionalGids are additional group ids set for the container's process.
AdditionalGids []uint32 `json:"additionalGids,omitempty"`
}

0 comments on commit a23a5c8

Please sign in to comment.