Skip to content

Commit e3a3fb6

Browse files
committed
runtime: Add 'exit' to state for collecting the container exit code
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 <[email protected]>
1 parent 3297cd5 commit e3a3fb6

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

runtime.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The value MAY be one of:
2222

2323
Additional values MAY be defined by the runtime, however, they MUST be used to represent new runtime states not defined above.
2424
* **`pid`** (int, REQUIRED when `status` is `created` or `running`) is the ID of the container process, as seen by the host.
25+
* **`exit`** (uint, REQUIRED when `status` is `stopped`) is the exit code of the container process.
2526
* **`bundlePath`** (string, REQUIRED) is the absolute path to the container's bundle directory.
2627
This is provided so that consumers can find the container's configuration and root filesystem on the host.
2728
* **`annotations`** (map, OPTIONAL) contains the list of annotations associated with the container.

schema/state-schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
"type": "integer",
2828
"minimum": 0
2929
},
30+
"exit": {
31+
"id": "https://opencontainers.org/schema/runtime/state/exit",
32+
"type": "integer",
33+
"minimum": 0
34+
},
3035
"bundlePath": {
3136
"id": "https://opencontainers.org/schema/runtime/state/bundlePath",
3237
"type": "string"

specs-go/state.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ type State struct {
1010
Status string `json:"status"`
1111
// Pid is the process ID for the container process.
1212
Pid int `json:"pid"`
13+
// Exit is the exit code the container process.
14+
Exit uint `json:"exit,omitempty"`
1315
// BundlePath is the path to the container's bundle directory.
1416
BundlePath string `json:"bundlePath"`
1517
// Annotations are the annotations associated with the container.

0 commit comments

Comments
 (0)