im having a small setup with a docker-in-docker (dind) container. when i try to run a container with docker run, and specifying cpu and memory limits in the command line
i ran this command inside dind container, and i got this error:
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: unable to apply cgroup configuration: cannot enter cgroupv2 "/sys/fs/cgroup/docker" with domain controllers -- it is in threaded mode: unknown.
i assume the error is with specifying cgroups for containers running dind. tried multiple solutions like starting docker daemon like this:
dockerd --cgroup-parent=/dind-cgroup
and adding this to daemon.json:
{
"cgroup-parent": "/dind-cgroup"
}
any of the above methods didnt work. but when i remove those --cpus and -m flag, the container runs properly. now, is there any other way (other than above mentioned solution) for me to fix cgroups parameter and allocate resources for containers running inside a dind container?
If you still had this problem, how did you start the dind container? I tried it in Docker Desktop for Mac and it worked there, but the issue is known and people say is happens because cgroup nesting should be enabled. I didn’t do anything in Docker Desktop.
Somewhere on GitHub I also read someone had problems with older Alpine based images. I used the latest docker:dind.