Docker "failed to create task: cgroups: cannot find cgroup mount" in CI
runc places each container in a cgroup to apply resource limits. When the expected cgroup filesystem is not mounted - common in nested or minimal environments, or on a cgroup v1/v2 mismatch - task creation fails with "cannot find cgroup mount destination".
What this error means
A docker run fails with failed to create task for container: ... cgroups: cannot find cgroup mount destination: unknown.
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: ... cgroups: cannot find cgroup mount destination: unknownCommon causes
The cgroup filesystem is not mounted
A minimal or nested host without /sys/fs/cgroup mounted leaves runc with no hierarchy.
A cgroup v1/v2 mismatch
A daemon expecting one cgroup version on a host configured for the other cannot find its mount.
How to fix it
Mount the cgroup filesystem for nested setups
- For dind, run privileged and mount the cgroup fs so runc finds the hierarchy.
docker run --privileged \
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
docker:27-dindAlign the cgroup driver/version
- Set the daemon cgroup driver to match the host, then restart the daemon.
{
"exec-opts": ["native.cgroupdriver=systemd"]
}How to prevent it
- Ensure
/sys/fs/cgroupis mounted in nested/dind environments. - Keep the daemon cgroup driver and version aligned with the host.