You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: runtime.md
+24-24Lines changed: 24 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,29 @@
1
-
# Runtime and Lifecycle
1
+
# <aname="runtimeAndLifecycle" />Runtime and Lifecycle
2
2
3
-
## Scope of a Container
3
+
## <aname="scopeOfAContainer" />Scope of a Container
4
4
5
5
Barring access control concerns, the entity using a runtime to create a container MUST be able to use the operations defined in this specification against that same container.
6
6
Whether other entities using the same, or other, instance of the runtime can see that container is out of scope of this specification.
7
7
8
-
## State
8
+
## <aname="state" />State
9
9
10
10
The state of a container MUST include, at least, the following properties:
11
11
12
-
***`ociVersion`**: (string) is the OCI specification version used when creating the container.
13
-
***`id`**: (string) is the container's ID.
12
+
*<aname="stateOciVersion" />**`ociVersion`**: (string) is the OCI specification version used when creating the container.
13
+
*<aname="stateId" />**`id`**: (string) is the container's ID.
14
14
This MUST be unique across all containers on this host.
15
15
There is no requirement that it be unique across hosts.
16
-
***`status`**: (string) is the runtime state of the container.
16
+
*<aname="stateStatus" />**`status`**: (string) is the runtime state of the container.
17
17
The value MAY be one of:
18
18
* `created`: the container has been created but the user-specified code has not yet been executed
19
19
* `running`: the container has been created and the user-specified code is running
20
20
* `stopped`: the container has been created and the user-specified code has been executed but is no longer running
21
21
22
22
Additional values MAY be defined by the runtime, however, they MUST be used to represent new runtime states not defined above.
23
-
***`pid`**: (int) is the ID of the container process, as seen by the host.
24
-
***`bundlePath`**: (string) is the absolute path to the container's bundle directory.
23
+
*<aname="statePid" />**`pid`**: (int) is the ID of the container process, as seen by the host.
24
+
*<aname="stateBundlePath" />**`bundlePath`**: (string) is the absolute path to the container's bundle directory.
25
25
This is provided so that consumers can find the container's configuration and root filesystem on the host.
26
-
***`annotations`**: (map) contains the list of annotations associated with the container.
26
+
*<aname="stateAnnotations" />**`annotations`**: (map) contains the list of annotations associated with the container.
27
27
If no annotations were provided then this property MAY either be absent or an empty map.
28
28
29
29
When serialized in JSON, the format MUST adhere to the following pattern:
@@ -43,43 +43,43 @@ When serialized in JSON, the format MUST adhere to the following pattern:
43
43
44
44
See [Query State](#query-state) for information on retrieving the state of a container.
45
45
46
-
## Lifecycle
46
+
## <aname="lifecycle" />Lifecycle
47
47
The lifecycle describes the timeline of events that happen from when a container is created to when it ceases to exist.
48
48
49
-
1. OCI compliant runtime's [`create`](runtime.md#create) command is invoked with a reference to the location of the bundle and a unique identifier.
50
-
2. The container's runtime environment MUST be created according to the configuration in [`config.json`](config.md).
49
+
1.<aname="lifecycle01" />OCI compliant runtime's [`create`](runtime.md#create) command is invoked with a reference to the location of the bundle and a unique identifier.
50
+
2.<aname="lifecycle02" />The container's runtime environment MUST be created according to the configuration in [`config.json`](config.md).
51
51
If the runtime is unable to create the environment specified in the [`config.json`](config.md), it MUST generate an error.
52
52
While the resources requested in the [`config.json`](config.md) MUST be created, the user-specified code (from [`process`](config.md#process-configuration)) MUST NOT be run at this time.
53
53
Any updates to [`config.json`](config.md) after this step MUST NOT affect the container.
54
-
3. Once the container is created additional actions MAY be performed based on the features the runtime chooses to support.
54
+
3.<aname="lifecycle03" />Once the container is created additional actions MAY be performed based on the features the runtime chooses to support.
55
55
However, some actions might only be available based on the current state of the container (e.g. only available while it is started).
56
-
4. Runtime's [`start`](runtime.md#start) command is invoked with the unique identifier of the container.
56
+
4.<aname="lifecycle04" />Runtime's [`start`](runtime.md#start) command is invoked with the unique identifier of the container.
57
57
The runtime MUST run the user-specified code, as specified by [`process`](config.md#process-configuration).
58
-
5. The container's process is stopped.
58
+
5.<aname="lifecycle05" />The container's process is stopped.
59
59
This MAY happen due to them erroring out, exiting, crashing or the runtime's [`kill`](runtime.md#kill) operation being invoked.
60
-
6. Runtime's [`delete`](runtime.md#delete) command is invoked with the unique identifier of the container.
60
+
6.<aname="lifecycle06" />Runtime's [`delete`](runtime.md#delete) command is invoked with the unique identifier of the container.
61
61
The container MUST be destroyed by undoing the steps performed during create phase (step 2).
62
62
63
-
## Errors
63
+
## <aname="errors" />Errors
64
64
65
65
In cases where the specified operation generates an error, this specification does not mandate how, or even if, that error is returned or exposed to the user of an implementation.
66
66
Unless otherwise stated, generating an error MUST leave the state of the environment as if the operation were never attempted - modulo any possible trivial ancillary changes such as logging.
67
67
68
-
## Operations
68
+
## <aname="operations" />Operations
69
69
70
70
OCI compliant runtimes MUST support the following operations, unless the operation is not supported by the base operating system.
71
71
72
72
Note: these operations are not specifying any command-line APIs, and the parameters are inputs for general operations.
73
73
74
-
### Query State
74
+
### <aname="queryState" />Query State
75
75
76
76
`state <container-id>`
77
77
78
78
This operation MUST generate an error if it is not provided the ID of a container.
79
79
Attempting to query a container that does not exist MUST generate an error.
80
80
This operation MUST return the state of a container as specified in the [State](#state) section.
81
81
82
-
### Create
82
+
### <aname="create" />Create
83
83
84
84
`create <container-id> <path-to-bundle>`
85
85
@@ -96,7 +96,7 @@ Runtime callers who are interested in pre-create validation can run [bundle-vali
96
96
97
97
Any changes made to the [`config.json`](config.md) file after this operation will not have an effect on the container.
98
98
99
-
### Start
99
+
### <aname="start" />Start
100
100
`start <container-id>`
101
101
102
102
This operation MUST generate an error if it is not provided the container ID.
@@ -106,7 +106,7 @@ This operation MUST run the user-specified code as specified by [`process`](conf
106
106
107
107
Upon successful completion of this operation the `status` property of this container MUST be `running`.
108
108
109
-
### Kill
109
+
### <aname="kill" />Kill
110
110
`kill <container-id> <signal>`
111
111
112
112
This operation MUST generate an error if it is not provided the container ID.
@@ -115,7 +115,7 @@ This operation MUST send the specified signal to the process in the container.
115
115
116
116
When the process in the container is stopped, irrespective of it being as a result of a `kill` operation or any other reason, the `status` property of this container MUST be `stopped`.
117
117
118
-
### Delete
118
+
### <aname="delete" />Delete
119
119
`delete <container-id>`
120
120
121
121
This operation MUST generate an error if it is not provided the container ID.
@@ -126,6 +126,6 @@ Note that resources associated with the container, but not created by this conta
126
126
Once a container is deleted its ID MAY be used by a subsequent container.
127
127
128
128
129
-
## Hooks
129
+
## <aname="hooks" />Hooks
130
130
Many of the operations specified in this specification have "hooks" that allow for additional actions to be taken before or after each operation.
131
131
See [runtime configuration for hooks](./config.md#hooks) for more information.
0 commit comments