-
Notifications
You must be signed in to change notification settings - Fork 593
runtime: Clarify UTS and mount cleanup on 'delete' #651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,11 +121,133 @@ When the process in the container is stopped, irrespective of it being as a resu | |
| This operation MUST generate an error if it is not provided the container ID. | ||
| Attempting to delete a container that does not exist MUST generate an error. | ||
| Attempting to delete a container whose process is still running MUST generate an error. | ||
| Deleting a container MUST delete the resources that were created during the `create` step. | ||
| Note that resources associated with the container, but not created by this container, MUST NOT be deleted. | ||
| Once a container is deleted its ID MAY be used by a subsequent container. | ||
|
|
||
| Deleting a container MUST delete the resources that were created during the `create` step. | ||
| Resources associated with the container, but not created by this container, MUST NOT be altered. | ||
|
|
||
| #### Examples of resource ownership | ||
|
|
||
| This section contains informative elaborations of the above “resources created by the container” requirements. | ||
| It is not intended to be exhaustive. | ||
|
|
||
| ##### Joining mount namespaces (Linux) | ||
|
|
||
| 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): | ||
|
|
||
| ```json | ||
| { | ||
| "ociVersion": "1.0.0-rc3", | ||
| "platform": { | ||
| "os": "linux", | ||
| "arch": "amd64" | ||
| }, | ||
| "process": { | ||
| "cwd": "/", | ||
| "args": [ | ||
| "sh" | ||
| ], | ||
| "user": { | ||
| "uid": 1, | ||
| "gid": 1 | ||
| } | ||
| }, | ||
| "root": { | ||
| "path": "rootfs" | ||
| }, | ||
| "linux": { | ||
| "namespaces": [ | ||
| { | ||
| "type": "mount", | ||
| "path": "/proc/1234/ns/mnt" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| When the example container is deleted, neither removing the preexisting mount namespace nor undoing the pivot into `rootfs` are allowed. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think deleting namespace is a bit overly specified, it probably is not true since on Linux, namespace is destroyed when the last process that is a member of the namespace terminates. So if we join a shared namespace and the original container exits, our container's terminates will delete this namespace, and that's something we should not interfere. |
||
|
|
||
| ##### Joining UTS namespaces (Linux) | ||
|
|
||
| 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): | ||
|
|
||
| ```json | ||
| { | ||
| "ociVersion": "1.0.0-rc3", | ||
| "platform": { | ||
| "os": "linux", | ||
| "arch": "amd64" | ||
| }, | ||
| "process": { | ||
| "cwd": "/", | ||
| "args": [ | ||
| "sh" | ||
| ], | ||
| "user": { | ||
| "uid": 1, | ||
| "gid": 1 | ||
| } | ||
| }, | ||
| "root": { | ||
| "path": "rootfs" | ||
| }, | ||
| "hostname": "alice", | ||
| "linux": { | ||
| "namespaces": [ | ||
| { | ||
| "type": "uts", | ||
| "path": "/proc/1234/ns/uts" | ||
| }, | ||
| { | ||
| "type": "mount" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| When the example container is deleted, neither removing the preexisting UTS namespace nor undoing the hostname change are allowed. | ||
|
|
||
| ##### Joining cgroups (Linux) | ||
|
|
||
| A container joins an existing [cgroup](config-linux.md#control-groups) on Linux and changes a [memory limit](config.md#memory) with the following [configuration](config.md): | ||
|
|
||
| ```json | ||
| { | ||
| "ociVersion": "1.0.0-rc3", | ||
| "platform": { | ||
| "os": "linux", | ||
| "arch": "amd64" | ||
| }, | ||
| "process": { | ||
| "cwd": "/", | ||
| "args": [ | ||
| "sh" | ||
| ], | ||
| "user": { | ||
| "uid": 1, | ||
| "gid": 1 | ||
| } | ||
| }, | ||
| "root": { | ||
| "path": "rootfs" | ||
| }, | ||
| "linux": { | ||
| "cgroupsPath": "/some/existing/container", | ||
| "resources": { | ||
| "memory": { | ||
| "limit": 100000 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| When the example container is deleted, neither removing the preexisting cgroup not undoing the memory limit change are allowed. | ||
|
|
||
| ## Hooks | ||
| Many of the operations specified in this specification have "hooks" that allow for additional actions to be taken before or after each operation. | ||
| See [runtime configuration for hooks](./config.md#hooks) for more information. | ||
|
|
||
| [container-namespace3]: glossary.md#container-namespace | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why we should have examples like this in the spec at all. Its too much overspecifying things and your descriptions are wrong anyways on how namespaces are "destroyed".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My example I know we have examples in the repo showing off how to populate fields but examples like this describing functionality/implementation don't belong in my opinion.