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
runtime: Clarify UTS and mount cleanup on 'delete'
Now that d43fc42 (config-linux: Lift no-tweaking namespace
restriction, 2017-01-11, opencontainers#649) allows us to get into this sort of
situation. This sort of ownership may also apply to other resources
(cgroups?), but we can handle them in follow-up commits.
Using an informative suggestion was recommended by Dao Quang Minh [1].
I've made the config JSON as small as possible while keeping it valid,
but there's still an unfortunate amount of boilerplate there. There
is in-flight work to let us at least drop process.args [2].
The new mount namespace in the UTS example avoids pivoting the host
namespace's root.
Also drop "Configuration" from the root header. Everything in that
file is a configuration.
container-namespace3 (instead of container-namespace) supports the
single-page, Pandoc-generated file (see e7be40f, Cleanup the spec a
bit to remove WG/git text that's not really part of the spec,
2016-11-14, opencontainers#626).
[1]: opencontainers#651
[2]: opencontainers#620
Signed-off-by: W. Trevor King <[email protected]>
Copy file name to clipboardExpand all lines: runtime.md
+87-2Lines changed: 87 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,11 +121,96 @@ When the process in the container is stopped, irrespective of it being as a resu
121
121
This operation MUST generate an error if it is not provided the container ID.
122
122
Attempting to delete a container that does not exist MUST generate an error.
123
123
Attempting to delete a container whose process is still running MUST generate an error.
124
-
Deleting a container MUST delete the resources that were created during the `create` step.
125
-
Note that resources associated with the container, but not created by this container, MUST NOT be deleted.
126
124
Once a container is deleted its ID MAY be used by a subsequent container.
127
125
126
+
Deleting a container MUST delete the resources that were created during the `create` step.
127
+
Resources associated with the container, but not created by this container, MUST NOT be altered.
128
+
129
+
#### Examples of resource ownership
130
+
131
+
This section contains informative elaborations of the above “resources created by the container” requirements.
132
+
It is not intended to be exhaustive.
133
+
134
+
##### Joining mount namespaces (Linux)
135
+
136
+
A container joins an existing [mount namespace](config-linux.md#namespaces) on Linux and pivots [root](config.md#root) into the `rootfs` directory with the following [configuration](config.md):
137
+
138
+
```json
139
+
{
140
+
"ociVersion": "1.0.0-rc3",
141
+
"platform": {
142
+
"os": "linux",
143
+
"arch": "amd64"
144
+
},
145
+
"process": {
146
+
"cwd": "/",
147
+
"args": [
148
+
"sh"
149
+
],
150
+
"user": {
151
+
"uid": 1,
152
+
"gid": 1
153
+
}
154
+
},
155
+
"root": {
156
+
"path": "rootfs"
157
+
},
158
+
"linux": {
159
+
"namespaces": [
160
+
{
161
+
"type": "mount",
162
+
"path": "/proc/1234/ns/mnt"
163
+
}
164
+
]
165
+
}
166
+
}
167
+
```
168
+
169
+
When the example container is deleted, neither removing the preexisting mount namespace nor undoing the pivot into `rootfs` are allowed.
170
+
171
+
##### Joining UTS namespaces (Linux)
172
+
173
+
A container joins an existing [UTS namespace](config-linux.md#namespaces) on Linux and changes the [hostname](config.md#hostname) with the following [configuration](config.md):
174
+
175
+
```json
176
+
{
177
+
"ociVersion": "1.0.0-rc3",
178
+
"platform": {
179
+
"os": "linux",
180
+
"arch": "amd64"
181
+
},
182
+
"process": {
183
+
"cwd": "/",
184
+
"args": [
185
+
"sh"
186
+
],
187
+
"user": {
188
+
"uid": 1,
189
+
"gid": 1
190
+
}
191
+
},
192
+
"root": {
193
+
"path": "rootfs"
194
+
},
195
+
"hostname": "alice",
196
+
"linux": {
197
+
"namespaces": [
198
+
{
199
+
"type": "uts",
200
+
"path": "/proc/1234/ns/uts"
201
+
},
202
+
{
203
+
"type": "mount"
204
+
}
205
+
]
206
+
}
207
+
}
208
+
```
209
+
210
+
When the example container is deleted, neither removing the preexisting UTS namespace nor undoing the hostname change are allowed.
128
211
129
212
## Hooks
130
213
Many of the operations specified in this specification have "hooks" that allow for additional actions to be taken before or after each operation.
131
214
See [runtime configuration for hooks](./config.md#hooks) for more information.
0 commit comments