Skip to content

cgroup-parent breaks hierarchical cgroups #16681

Closed
@mohitsoni

Description

While working on docker/compose#2114, I noticed that docker handles cgroups hierarchies via cgroup-parent flag a little differently.

For ex:
First, I launched a parent docker container using:

docker run busybox ping www.docker.com

For this container daemon creates a cgroup here:

# cat /proc/10968/cgroup 
...
8:memory:/system.slice/docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope
6:cpuset:/system.slice/docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope
5:net_cls,net_prio:/system.slice/docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope
2:cpu,cpuacct:/system.slice/docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope
...

Next, I launch another container using cgroup-parent flag:

docker run --cgroup-parent docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope busybox ping www.paypal.com

For this container, docker creates a cgroup, but the hierarchy is broken:

# cat /proc/11105/cgroup 
...
8:memory:/system.slice/docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope-33917fb99f596633a1731a90f91b1d079528c6898e512e90b6eae89af462c52a.scope
6:cpuset:/system.slice/docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope-33917fb99f596633a1731a90f91b1d079528c6898e512e90b6eae89af462c52a.scope
5:net_cls,net_prio:/system.slice/docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope-33917fb99f596633a1731a90f91b1d079528c6898e512e90b6eae89af462c52a.scope
2:cpu,cpuacct:/system.slice/docker-773e468adb0e97459059804f5906fee50edfe37fb4babad5655508fa7a1f27e0.scope-33917fb99f596633a1731a90f91b1d079528c6898e512e90b6eae89af462c52a.scope
...

Is this the expected behavior ? I assumed that cgroup-parent flag should nest the child's cgroup under the parent.

Here's are some details of my system:

# docker version
Client:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   0a8c2e3
 Built:        Thu Sep 10 19:21:21 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   0a8c2e3
 Built:        Thu Sep 10 19:21:21 UTC 2015
 OS/Arch:      linux/amd64
# uname -a
Linux mohit-mate 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions