Skip to content
Latchkey

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.

docker
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: unknown

Common 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

  1. For dind, run privileged and mount the cgroup fs so runc finds the hierarchy.
Terminal
docker run --privileged \
  -v /sys/fs/cgroup:/sys/fs/cgroup:rw \
  docker:27-dind

Align the cgroup driver/version

  1. Set the daemon cgroup driver to match the host, then restart the daemon.
/etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"]
}

How to prevent it

  • Ensure /sys/fs/cgroup is mounted in nested/dind environments.
  • Keep the daemon cgroup driver and version aligned with the host.

Frequently asked questions

What causes ""cannot find cgroup mount""?
A minimal or nested host without /sys/fs/cgroup mounted leaves runc with no hierarchy.
How do I fix "cannot find cgroup mount"?
Mount the cgroup filesystem for nested setups

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card