|
2 | 2 |
|
3 | 3 | ## State |
4 | 4 |
|
5 | | -Runtime MUST store container metadata on disk so that external tools can consume and act on this information. |
| 5 | +An OCI compliant runtime MUST store container metadata on disk so that external tools can consume and act on this information. |
6 | 6 | It is recommended that this data be stored in a temporary filesystem so that it can be removed on a system reboot. |
7 | 7 | On Linux/Unix based systems the metadata MUST be stored under `/run/opencontainer/containers`. |
8 | 8 | For non-Linux/Unix based systems the location of the root metadata directory is currently undefined. |
@@ -33,24 +33,79 @@ This is provided so that consumers can find the container's configuration and ro |
33 | 33 | } |
34 | 34 | ``` |
35 | 35 |
|
36 | | -## Lifecycle |
| 36 | +## Operations |
| 37 | + |
| 38 | +OCI compliant runtimes MUST support the following operations, unless support for the operation can not be supported by the base operating system (kernel) itself. |
| 39 | + |
| 40 | +OPEN: we should consider specifying the options/args for each operation. |
| 41 | +For example, checkpoint (for runc) seems to have a lot of params. |
37 | 42 |
|
38 | 43 | ### Create |
39 | 44 |
|
40 | | -Creates the container: file system, namespaces, cgroups, capabilities. |
| 45 | +Using the `config.json` and `runtime.json` files, along with the file system path referenced in the `config.json`, this operation MUST create a new container. |
| 46 | +This includes creating the relevant namespaces, cgroups and configuring the appropriate capabilities for the container. |
| 47 | + |
| 48 | +### Start |
| 49 | + |
| 50 | +This operation MUST start a previously created container. |
| 51 | +Starting a container MUST create a new process, as specified by the `config.json` file within the scope of the container. |
| 52 | +Attempting to start an already running container MUST have no effect on the container and MUST generate an error. |
| 53 | +Starting a stopped container, one that had been previously be running, MUST create a new process, as specified by the `config.json` file, within the scope of the container. |
| 54 | + |
| 55 | +OPEN: the entire "generate an error" stuff in here is something we should discuss. |
| 56 | +My initial thought was that it would be better to generate an error so that the call would know exactly what happened - meaning, did something new take place or was the container already running. If we didn't return an error (or something) then the caller wouldn't know. And they can always ignore errors if they want/need to. |
| 57 | + |
| 58 | +### Stop |
| 59 | + |
| 60 | +This operation MUST stop a running container. |
| 61 | +Stopping a container MUST stop all of the processes running within the scope of the container. |
| 62 | +Stopping a container MUST NOT delete the associated namespaces or cgroups for the container. |
| 63 | +Attempting to stop a container that is not running MUST have no effect on the container and MUST generate an error. |
| 64 | + |
| 65 | +### Delete |
| 66 | + |
| 67 | +This operation MUST delete a container. |
| 68 | +Deleting a container MUST delete the associated namespaces and cgroups for the container. |
| 69 | +Deleting a container that is not stopped MUST first stop the container as specified by the `stop` operation. |
| 70 | +If the implied `stop` operations fails then the `delete` operation MUST fail. |
| 71 | + |
| 72 | +### Pause |
| 73 | + |
| 74 | +This operation MUST suspend all processes that are running within the container. |
| 75 | +If the container is not running, either stopped or aleady paused, then this operation MUST have no effect on the container and MUST generate an error. |
| 76 | + |
| 77 | +### Unpause |
| 78 | + |
| 79 | +This operation MUST resume all processes that were previously paused via the `pause` operation. |
| 80 | +If the container is not paused then this operation MUST have no effect on the container and MUST generate an error. |
| 81 | + |
| 82 | +### Exec |
| 83 | + |
| 84 | +This operation MUST create a new process within the scope of the container. |
| 85 | +If the container is not running then this operation MUST have no effect on the container and MUST generate an error. |
| 86 | +Executing this operation multiple times MUST result in a new process each time. |
| 87 | +Unlike the container's main process which is specified in the `config.json` file, this specification does not define how the `exec` process is defined. |
| 88 | + |
| 89 | +### Checkpoint |
| 90 | + |
| 91 | +This operation MUST create a checkpoint of a running container. |
| 92 | +If the container is not running then this operation MUST have no effect on the container and MUST generate an error. |
| 93 | +This specification does not specify how, or to where, the checkpoint data is persisted. |
| 94 | + |
| 95 | +OPEN: can we checkpoint a stopped container? |
41 | 96 |
|
42 | | -### Start (process) |
| 97 | +OPEN: What's the state of the container afterwards? runc allows for the user to specify it. |
43 | 98 |
|
44 | | -Runs a process in a container. |
45 | | -Can be invoked several times. |
| 99 | +OPEN: we really should specify where to find the checkpoint info the same way we tell people where the state data is kept. |
46 | 100 |
|
47 | | -### Stop (process) |
| 101 | +### Restore |
48 | 102 |
|
49 | | -Not sure we need that from runc cli. |
50 | | -Process is killed from the outside. |
| 103 | +This operation MUST restore a container to a previously created checkpoint state. |
| 104 | +This specification does not specify how, or from where, the checkpoint data is provided to the runtime. |
51 | 105 |
|
52 | | -This event needs to be captured by runc to run onstop event handlers. |
| 106 | +OPEN: what state must the container be in before they can do this? |
53 | 107 |
|
54 | 108 | ## Hooks |
55 | 109 |
|
56 | | -See [runtime configuration for hooks](./runtime-config.md) |
| 110 | +Many of the operations specified in this specification have "hooks" that allow for additional actions to be taken before or after each operation. |
| 111 | +See [runtime configuration for hooks](./runtime-config.md) for more information. |
0 commit comments