From 7071706c96cdedcd2808bde509b05f5c46b101f0 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 4 Jun 2016 23:09:32 -0700 Subject: [PATCH] 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, 'user' is also required for 'uid' and 'gid'. 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. On Windows, username is optional, but it's not clear how intentional that was [6]. [1]: https://github.com/opencontainers/runtime-spec/pull/417#issuecomment-216076069 [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: <20160114233625.GN6362@odin.tremily.us> [3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-04-17.00.log.html#l-44 [4]: https://github.com/opencontainers/runtime-spec/pull/417#issuecomment-216937010 [5]: https://github.com/opencontainers/runtime-spec/pull/417#issuecomment-216937090 [6]: https://github.com/opencontainers/runtime-spec/issues/618 Signed-off-by: W. Trevor King --- config.md | 2 +- runtime.md | 1 + schema/config-schema.json | 3 +-- specs-go/config.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.md b/config.md index 85c43c1ec..b9f297d8b 100644 --- a/config.md +++ b/config.md @@ -126,7 +126,7 @@ See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [Se * **`cwd`** (string, REQUIRED) is the working directory that will be set for the executable. This value MUST be an absolute path. * **`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2001's `environ`][ieee-1003.1-2001-xbd-c8.1]. -* **`args`** (array of strings, REQUIRED) with similar semantics to [IEEE Std 1003.1-2001 `execvp`'s *argv*][ieee-1003.1-2001-xsh-exec]. +* **`args`** (array of strings, OPTIONAL) with similar semantics to [IEEE Std 1003.1-2001 `execvp`'s *argv*][ieee-1003.1-2001-xsh-exec]. This specification extends the IEEE standard in that at least one entry is REQUIRED, and that entry is used with the same semantics as `execvp`'s *file*. For Linux-based systems the process structure supports the following process specific fields: diff --git a/runtime.md b/runtime.md index 6b8a66472..c551be32e 100644 --- a/runtime.md +++ b/runtime.md @@ -103,6 +103,7 @@ This operation MUST generate an error if it is not provided the container ID. Attempting to start a container that does not exist MUST generate an error. Attempting to start an already started container MUST have no effect on the container and MUST generate an error. This operation MUST run the user-specified program as specified by [`process`](config.md#process). +This operation MUST generate an error if `process.args` was not set. Upon successful completion of this operation the `status` property of this container MUST be `running`. diff --git a/schema/config-schema.json b/schema/config-schema.json index 9bae9ad18..4963c5ed0 100644 --- a/schema/config-schema.json +++ b/schema/config-schema.json @@ -74,8 +74,7 @@ "id": "https://opencontainers.org/schema/bundle/process", "type": "object", "required": [ - "cwd", - "args" + "cwd" ], "properties": { "args": { diff --git a/specs-go/config.go b/specs-go/config.go index a387cf90a..6a5d1612d 100644 --- a/specs-go/config.go +++ b/specs-go/config.go @@ -38,7 +38,7 @@ type Process struct { // User specifies user information for the process. User User `json:"user"` // Args specifies the binary and arguments for the application to execute. - Args []string `json:"args"` + Args []string `json:"args,omitempty"` // Env populates the process environment for the process. Env []string `json:"env,omitempty"` // Cwd is the current working directory for the process and must be