Skip to content

Commit ce19b8d

Browse files
committed
*: add support for cgroup namespace
The cgroup namespace is a new kernel feature available in 4.6+ that allows a container to isolate its cgroup hierarchy. This currently only allows for hiding information from /proc/self/cgroup, and mounting cgroupfs as an unprivileged user. In the future, this namespace may allow for subtree management by a container. Signed-off-by: Aleksa Sarai <[email protected]>
1 parent 0dde4f9 commit ce19b8d

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-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": [

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)