Skip to content

Commit 831d961

Browse files
committed
Merge pull request opencontainers#397 from cyphar/add-cgroup-namespace
*: add support for cgroup namespace
2 parents eeeecb0 + d514aad commit 831d961

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

config-linux.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ Namespaces are specified as an array of entries inside the `namespaces` root fie
2727
The following parameters can be specified to setup namespaces:
2828

2929
* **`type`** *(string, required)* - namespace type. The following namespaces types are supported:
30-
* **`pid`** processes inside the container will only be able to see other processes inside the same container
31-
* **`network`** the container will have its own network stack
32-
* **`mount`** the container will have an isolated mount table
33-
* **`ipc`** processes inside the container will only be able to communicate to other processes inside the same container via system level IPC
34-
* **`uts`** the container will be able to have its own hostname and domain name
35-
* **`user`** the container will be able to remap user and group IDs from the host to local users and groups within the container
30+
* **`pid`** processes inside the container will only be able to see other processes inside the same container.
31+
* **`network`** the container will have its own network stack.
32+
* **`mount`** the container will have an isolated mount table.
33+
* **`ipc`** processes inside the container will only be able to communicate to other processes inside the same container via system level IPC.
34+
* **`uts`** the container will be able to have its own hostname and domain name.
35+
* **`user`** the container will be able to remap user and group IDs from the host to local users and groups within the container.
36+
* **`cgroup`** the container will have an isolated view of the cgroup hierarchy.
3637

3738
* **`path`** *(string, optional)* - path to namespace file in the [runtime mount namespace](glossary.md#runtime-namespace)
3839

@@ -62,6 +63,9 @@ Also, when a path is specified, a runtime MUST assume that the setup for that pa
6263
},
6364
{
6465
"type": "user"
66+
},
67+
{
68+
"type": "cgroup"
6569
}
6670
]
6771
```

config.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,12 @@ Here is a full example `config.json` for reference.
643643
},
644644
{
645645
"type": "mount"
646+
},
647+
{
648+
"type": "user"
649+
},
650+
{
651+
"type": "cgroup"
646652
}
647653
],
648654
"maskedPaths": [

runtime.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The lifecycle describes the timeline of events that happen from when a container
4848

4949
1. OCI compliant runtime's `create` command is invoked with a reference to the location of the bundle and a unique identifier.
5050
2. The container's runtime environment MUST be created according to the configuration in [`config.json`](config.md).
51+
If the runtime is unable to create the environment specified in the [`config.json`](config.md), it MUST generate an error.
5152
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.
5253
Any updates to `config.json` after this step MUST NOT affect the container.
5354
3. Once the container is created additional actions MAY be performed based on the features the runtime chooses to support.

schema/defs-linux.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@
224224
"network",
225225
"uts",
226226
"ipc",
227-
"user"
227+
"user",
228+
"cgroup"
228229
]
229230
},
230231
"NamespaceReference": {

specs-go/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ const (
169169
UTSNamespace = "uts"
170170
// UserNamespace for isolating user and group IDs
171171
UserNamespace = "user"
172+
// CgroupNamespace for isolating cgroup hierarchies
173+
CgroupNamespace = "cgroup"
172174
)
173175

174176
// IDMapping specifies UID/GID mappings

0 commit comments

Comments
 (0)