Skip to content

Commit 00cce32

Browse files
committed
runtime: Add a 'state' command
Partially catch up with opencontainers/runtime-spec@7117ede7 (Expand on the definition of our ops, 2015-10-13, opencontainers/runtime-spec#225, v0.4.0). The state example is adapted from the current release [1], but we defer the actual definition of that JSON to runtime-spec. The encoding for the output JSON (and all standard-stream activity) is covered by the "Character encodings" section. [1]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc1/runtime.md#state Signed-off-by: W. Trevor King <wking@tremily.us>
1 parent f827719 commit 00cce32

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

runtime.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,38 @@ $ echo $?
7070
42
7171
```
7272

73+
### state
74+
75+
Request the container state.
76+
77+
* *Arguments*
78+
* *`<ID>`* The container whose state is being requested.
79+
* *Standard streams:*
80+
* *stdin:* The runtime MUST NOT attempt to read from its stdin.
81+
* *stdout:* The runtime MUST print the state JSON to its stdout.
82+
* *stderr:* The runtime MAY print diagnostic messages to stderr, and the format for those lines is not specified in this document.
83+
* *Exit code:* Zero if the state was successfully written to stdout and non-zero on errors.
84+
85+
#### Example
86+
87+
```
88+
# in a bundle directory with a process that sleeps for several seconds
89+
$ funC start --id sleeper-1 &
90+
$ funC state sleeper-1
91+
{
92+
"ociVersion": "1.0.0-rc1",
93+
"id": "sleeper-1",
94+
"status": "running",
95+
"pid": 4422,
96+
"bundlePath": "/containers/sleeper",
97+
"annotations" {
98+
"myKey": "myValue"
99+
}
100+
}
101+
$ echo $?
102+
0
103+
```
104+
73105
[posix-encoding]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html#tag_06_02
74106
[posix-lang]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_02
75107
[posix-locale-encoding: http://www.unicode.org/reports/tr35/#Bundle_vs_Item_Lookup

0 commit comments

Comments
 (0)