|
| 1 | +# Runtime Command Line Interface |
| 2 | + |
| 3 | +This document specifies the command line syntax for runtime operations defined in the [Runtime and Lifecycle](runtime.md) specification. |
| 4 | +It is STRONGLY RECOMMENDED that implementations adhere to the command line definition defined below to ensure interoperability. |
| 5 | +This document will not duplicate the information/semantics specified in the [Runtime and Lifecycle](runtime.md) document, rather it just focuses on syntax of the command line. |
| 6 | + |
| 7 | +## Convention |
| 8 | + |
| 9 | +For the purpose of this document, the following syntactical conventions are used: |
| 10 | + |
| 11 | +* `[ ... ]` denotes an optional field |
| 12 | +* `< ... >` denotes a substitution field. |
| 13 | +The word(s), or phrase, within the `<>` describes the information to be passed-in. |
| 14 | + |
| 15 | +## General Format and Behavior |
| 16 | + |
| 17 | +The general format of all commands MUST be: |
| 18 | +``` |
| 19 | +runtime [global-options] action [action-specific-options] [arguments] |
| 20 | +``` |
| 21 | + |
| 22 | +Upon successful running of an action, the exit code MUST be zero. |
| 23 | + |
| 24 | +If there is an error during the running of an action, then: |
| 25 | +* the exit code MUST be non-zero |
| 26 | +* any error text MUST be displayed on stderr |
| 27 | +* the state of the environment MUST be the same as if the action was never attempted (modulo any possible trivial ancillary changes such as logging) |
| 28 | + |
| 29 | +### Global Options |
| 30 | + |
| 31 | +Global options are ones that apply to all actions. |
| 32 | +This specification doesn't define any global options. |
| 33 | +Implementation MAY define their own. |
| 34 | + |
| 35 | +### Action Specific Options |
| 36 | + |
| 37 | +All actions MUST support the `--help` action-specific-option, which: |
| 38 | +* MUST display some help text to stdout |
| 39 | +* MUST NOT perform the `action` itself |
| 40 | +* MUST have an exit code of zero if the help text is successfully displayed |
| 41 | + |
| 42 | +Implementations MAY define their own action-specific options. |
| 43 | + |
| 44 | +## Actions |
| 45 | + |
| 46 | +This section defines the actions defined by this specification. |
| 47 | + |
| 48 | +### State |
| 49 | + |
| 50 | +Format: `runtime [global-options] state [options] <container-id>` |
| 51 | + |
| 52 | +Options: None |
| 53 | + |
| 54 | +This action MUST display the state of the specific container to stdout. |
| 55 | +Unless otherwise specified by the user, the format of the state MUST be in JSON. |
| 56 | + |
| 57 | +See [Query State](runtime.md#query-state). |
| 58 | + |
| 59 | +### Create |
| 60 | + |
| 61 | +Format: `runtime [global-options] create [options] <container-id>` |
| 62 | + |
| 63 | +Options: |
| 64 | +* `-b <dir>`, `--bundle <dir>` The path to the root of the bundle directory. If not specified the default value MUST be the current working directory. |
| 65 | +* `--console <path>` The PTY slave path for the newly created container. |
| 66 | +* `--pid-file <path>` The file path into which the process ID is written. If not specified then a file MUST not be created. |
| 67 | + |
| 68 | +See [Create](runtime.md#create). |
| 69 | + |
| 70 | +### Start |
| 71 | + |
| 72 | +Format: `runtime [global-options] start [options] <container-id>` |
| 73 | + |
| 74 | +Options: None |
| 75 | + |
| 76 | +See [Start](runtime.md#start). |
| 77 | + |
| 78 | +### Kill |
| 79 | + |
| 80 | +Format: `runtime [global-options] kill [options] <container-id> <signal>` |
| 81 | + |
| 82 | +Options: None |
| 83 | + |
| 84 | +The `signal` MUST either be the signal's numerical value (e.g. `15`) or the signal's name (e.g. `SIGTERM`). |
| 85 | + |
| 86 | +See [Kill](runtime.md#kill). |
| 87 | + |
| 88 | +### Delete |
| 89 | + |
| 90 | +Format: `runtime [global-options] delete [options] <container-id>` |
| 91 | + |
| 92 | +Options: None |
| 93 | + |
| 94 | +See [Delete](runtime.md#delete). |
0 commit comments