Specifying cgroup limits on a child container fails with cgroups v2 #6288
Description
- I have tried with the latest version of Docker Desktop
- I have tried disabling enabled experimental features
- I have uploaded Diagnostics
- Diagnostics ID: 349C1670-A8E6-4837-B3CC-070AC29DDCC5/20220421135113
Expected behavior
Specifying cgroup limits to a child container should work as expected when using cgroups v2
Actual behavior
Specifying cgroup limits to a child container when using cgroups v2 causes an error
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:385: applying cgroup configuration for process caused: cannot enter cgroupv2 "/sys/fs/cgroup/docker/daf122c11ae7f14b6a8174ec6338e9740f1c26a60b332a6094527ffbfa7f302f" with domain controllers -- it is in domain threaded mode: unknown.
Information
- macOS Version: Monterey 12.2.1
- Intel chip or Apple chip: Intel
- Docker Desktop Version: 4.7.0
Output of /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check
Starting diagnostics
[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0031: does the Docker API work?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0001: is the application running?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0017: can a VM be started?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0003: is the Docker CLI working?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0007: is the backend responding?
[PASS] DD0014: are the backend processes running?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[PASS] DD0012: is the VM networking working?
[PASS] DD0032: do Docker networks overlap with host IPs?
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0019: is the com.docker.vmnetd process responding?
[PASS] DD0033: does the host have Internet access?
No fatal errors detected.
Steps to reproduce the behavior
- Ensure cgroups v2 is being used (ie,
docker info
) - Run a container with a cgroup limit
docker run --rm -d --name pause -p 8080:80 --ipc=shareable --cpus=1 gcr.io/google_containers/pause-amd64:3.0
- Run a child container with limits specified as well
docker run --rm --name stress --net=container:pause --ipc=container:pause --pid=container:pause --cgroup-parent="/docker/<parent-id>" --cpus=2 alexeiled/stress-ng --cpu=2
An error is produced:
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:385: applying cgroup configuration for process caused: cannot enter cgroupv2 "/sys/fs/cgroup/docker/daf122c11ae7f14b6a8174ec6338e9740f1c26a60b332a6094527ffbfa7f302f" with domain controllers -- it is in domain threaded mode: unknown.
Running the child container without --cpu=2
allows the container the work. The failing case also works fine on linux.