Skip to content

Commit

Permalink
*: add support for cgroup namespace
Browse files Browse the repository at this point in the history
The cgroup namespace is a new kernel feature available in 4.6+ that
allows a container to isolate its cgroup hierarchy. This is invaluable
for hiding information from /proc/self/cgroup, but it also allows you to
modify your hierarchy inside a user namespace (even a rootless
container).

Signed-off-by: Aleksa Sarai <[email protected]>
  • Loading branch information
cyphar committed Apr 25, 2016
1 parent f955d90 commit bc0d866
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The following parameters can be specified to setup namespaces:
* **`ipc`** processes inside the container will only be able to communicate to other processes inside the same container via system level IPC
* **`uts`** the container will be able to have its own hostname and domain name
* **`user`** the container will be able to remap user and group IDs from the host to local users and groups within the container
* **`cgroup`** the container will have an isolated cgroup hierarchy that it can manage

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

Expand Down Expand Up @@ -62,6 +63,9 @@ Also, when a path is specified, a runtime MUST assume that the setup for that pa
},
{
"type": "user"
},
{
"type": "cgroup"
}
]
```
Expand Down
6 changes: 6 additions & 0 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,12 @@ Here is a full example `config.json` for reference.
},
{
"type": "mount"
},
{
"type": "user"
},
{
"type": "cgroup"
}
],
"maskedPaths": [
Expand Down
3 changes: 2 additions & 1 deletion schema/defs-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@
"network",
"uts",
"ipc",
"user"
"user",
"cgroup"
]
},
"NamespaceReference": {
Expand Down
2 changes: 2 additions & 0 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ const (
UTSNamespace = "uts"
// UserNamespace for isolating user and group IDs
UserNamespace = "user"
// CgroupNamespace for isolating cgroup hierarchies
CgroupNamespace = "cgroup"
)

// IDMapping specifies UID/GID mappings
Expand Down

0 comments on commit bc0d866

Please sign in to comment.