Skip to content

Commit

Permalink
runtime: Add 'exit' to state for collecting the container exit code
Browse files Browse the repository at this point in the history
This gives us a more portable way to discover the container exit code
(vs. requiring callers to use subreapers [1] or other
platform-specific approaches which require knowledge of the runtime
implementation).

[1]: opencontainers/runc#827 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
  • Loading branch information
wking committed Feb 3, 2017
1 parent 3297cd5 commit e3a3fb6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime.md
Expand Up @@ -22,6 +22,7 @@ The value MAY be one of:

Additional values MAY be defined by the runtime, however, they MUST be used to represent new runtime states not defined above.
* **`pid`** (int, REQUIRED when `status` is `created` or `running`) is the ID of the container process, as seen by the host.
* **`exit`** (uint, REQUIRED when `status` is `stopped`) is the exit code of the container process.
* **`bundlePath`** (string, REQUIRED) is the absolute path to the container's bundle directory.
This is provided so that consumers can find the container's configuration and root filesystem on the host.
* **`annotations`** (map, OPTIONAL) contains the list of annotations associated with the container.
Expand Down
5 changes: 5 additions & 0 deletions schema/state-schema.json
Expand Up @@ -27,6 +27,11 @@
"type": "integer",
"minimum": 0
},
"exit": {
"id": "https://opencontainers.org/schema/runtime/state/exit",
"type": "integer",
"minimum": 0
},
"bundlePath": {
"id": "https://opencontainers.org/schema/runtime/state/bundlePath",
"type": "string"
Expand Down
2 changes: 2 additions & 0 deletions specs-go/state.go
Expand Up @@ -10,6 +10,8 @@ type State struct {
Status string `json:"status"`
// Pid is the process ID for the container process.
Pid int `json:"pid"`
// Exit is the exit code the container process.
Exit uint `json:"exit,omitempty"`
// BundlePath is the path to the container's bundle directory.
BundlePath string `json:"bundlePath"`
// Annotations are the annotations associated with the container.
Expand Down

0 comments on commit e3a3fb6

Please sign in to comment.