Skip to content

Commit bf042d9

Browse files
committed
config: Make 'process.args' optional
Since be59415 (Split create and start, 2016-04-01, #384), it's possible for a container process to never execute user-specified code (e.g. you can call 'create', 'kill', 'delete' without calling 'start'). For folks who expect to do that, there's no reason to define process.args. The only other process property required for all platforms is 'cwd', but the runtime's idler code isn't specified in sufficient detail for the configuration author to have an opinion about what its working directory should be. On Linux and Solaris, uid and gid are also required. My preferred approach here is to make those optional and define defaults [1,2]: If unset, the runtime will not attempt to manipulate the user ID (e.g. not calling setuid(2) or similar). But the maintainer consensus is that they want those to be explicitly required properties [3,4,5]. With the current spec, one option could be to make process optional (with the idler's working directory unspecified) for OSes besides Linux and Solaris, but the main reason that Windows doesn't have a user property is that we don't know how to specify it [6]. I expect all platforms will have some sort of required user field, which means they'll all have to define 'process'. While I'm indenting the sub-properties, also wrap them to one line per sentence (style.md). [1]: #417 (comment) [2]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/DWdystx5X3A Subject: Exposing platform defaults Date: Thu, 14 Jan 2016 15:36:26 -0800 Message-ID: <[email protected]> [3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-04-17.00.log.html#l-44 [4]: #417 (comment) [5]: #417 (comment) [6]: #96 (comment) Signed-off-by: W. Trevor King <[email protected]>
1 parent b953df4 commit bf042d9

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

config.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,35 @@ For the Windows operating system, one mount destination MUST NOT be nested withi
8484
See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [SetVolumeMountPoint](https://msdn.microsoft.com/en-us/library/windows/desktop/aa365561(v=vs.85).aspx) in Windows.
8585

8686

87-
## Process configuration
88-
89-
* **`terminal`** (bool, optional) specifies whether you want a terminal attached to that process. Defaults to false.
90-
* **`cwd`** (string, required) is the working directory that will be set for the executable. This value MUST be an absolute path.
91-
* **`env`** (array of strings, optional) contains a list of variables that will be set in the process's environment prior to execution. Elements in the array are specified as Strings in the form "KEY=value". The left hand side MUST consist solely of letters, digits, and underscores `_` as outlined in [IEEE Std 1003.1-2001](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html).
92-
* **`args`** (array of strings, required) executable to launch and any flags as an array. The executable is the first element and MUST be available at the given path inside of the rootfs. If the executable path is not an absolute path then the search $PATH is interpreted to find the executable.
93-
94-
For Linux-based systems the process structure supports the following process specific fields:
95-
96-
* **`capabilities`** (array of strings, optional) capabilities is an array that specifies Linux capabilities that can be provided to the process inside the container.
97-
Valid values are the strings for capabilities defined in [the man page](http://man7.org/linux/man-pages/man7/capabilities.7.html)
98-
* **`rlimits`** (array of rlimits, optional) rlimits is an array of rlimits that allows setting resource limits for a process inside the container.
99-
The kernel enforces the `soft` limit for a resource while the `hard` limit acts as a ceiling for that value that could be set by an unprivileged process.
100-
Valid values for the 'type' field are the resources defined in [the man page](http://man7.org/linux/man-pages/man2/setrlimit.2.html).
101-
* **`apparmorProfile`** (string, optional) apparmor profile specifies the name of the apparmor profile that will be used for the container.
102-
For more information about Apparmor, see [Apparmor documentation](https://wiki.ubuntu.com/AppArmor)
103-
* **`selinuxLabel`** (string, optional) SELinux process label specifies the label with which the processes in a container are run.
104-
For more information about SELinux, see [Selinux documentation](http://selinuxproject.org/page/Main_Page)
105-
* **`noNewPrivileges`** (bool, optional) setting `noNewPrivileges` to true prevents the processes in the container from gaining additional privileges.
106-
[The kernel doc](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt) has more information on how this is achieved using a prctl system call.
87+
## Process
88+
89+
* **`process`** (object, required) configures the container process.
90+
It supports the following properties:
91+
92+
* **`terminal`** (bool, optional) specifies whether you want a terminal attached to that process.
93+
Defaults to false.
94+
* **`cwd`** (string, required) is the working directory that will be set for the executable.
95+
This value MUST be an absolute path.
96+
* **`env`** (array of strings, optional) contains a list of variables that will be set in the process's environment prior to execution.
97+
Elements in the array are specified as Strings in the form "KEY=value".
98+
The left hand side MUST consist solely of letters, digits, and underscores `_` as outlined in [IEEE Std 1003.1-2001](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html).
99+
* **`args`** (array of strings, optional) executable to launch and any flags as an array.
100+
The executable is the first element and MUST be available at the given path inside of the rootfs.
101+
If the executable path is not an absolute path then the search $PATH is interpreted to find the executable.
102+
103+
For Linux-based systems the process structure supports the following process specific fields:
104+
105+
* **`capabilities`** (array of strings, optional) capabilities is an array that specifies Linux capabilities that can be provided to the process inside the container.
106+
Valid values are the strings for capabilities defined in [the man page](http://man7.org/linux/man-pages/man7/capabilities.7.html)
107+
* **`rlimits`** (array of rlimits, optional) rlimits is an array of rlimits that allows setting resource limits for a process inside the container.
108+
The kernel enforces the `soft` limit for a resource while the `hard` limit acts as a ceiling for that value that could be set by an unprivileged process.
109+
Valid values for the 'type' field are the resources defined in [the man page](http://man7.org/linux/man-pages/man2/setrlimit.2.html).
110+
* **`apparmorProfile`** (string, optional) apparmor profile specifies the name of the apparmor profile that will be used for the container.
111+
For more information about Apparmor, see [Apparmor documentation](https://wiki.ubuntu.com/AppArmor)
112+
* **`selinuxLabel`** (string, optional) SELinux process label specifies the label with which the processes in a container are run.
113+
For more information about SELinux, see [Selinux documentation](http://selinuxproject.org/page/Main_Page)
114+
* **`noNewPrivileges`** (bool, optional) setting `noNewPrivileges` to true prevents the processes in the container from gaining additional privileges.
115+
[The kernel doc](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt) has more information on how this is achieved using a prctl system call.
107116

108117
### User
109118

runtime.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ This operation MUST generate an error if it is not provided the container ID.
102102
Attempting to start a container that does not exist MUST generate an error.
103103
Attempting to start an already started container MUST have no effect on the container and MUST generate an error.
104104
This operation MUST run the user-specified code as specified by [`process`](config.md#process-configuration).
105+
If `process.args` was not configured, the runtime MUST generate an error.
105106

106107
Upon successful completion of this operation the `status` property of this container MUST be `running`.
107108

schema/schema.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@
8383
"id": "https://opencontainers.org/schema/bundle/process",
8484
"type": "object",
8585
"required": [
86-
"cwd",
87-
"args"
86+
"cwd"
8887
],
8988
"properties": {
9089
"args": {

specs-go/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Process struct {
3434
// User specifies user information for the process.
3535
User User `json:"user"`
3636
// Args specifies the binary and arguments for the application to execute.
37-
Args []string `json:"args"`
37+
Args []string `json:"args,omitempty"`
3838
// Env populates the process environment for the process.
3939
Env []string `json:"env,omitempty"`
4040
// Cwd is the current working directory for the process and must be

0 commit comments

Comments
 (0)