docker resource_limits ai_generated true

OCI runtime create failed: cgroup limit reached

ID: docker/docker-cgroup-limit

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
27 active — — —

Root Cause

Container exceeded cgroup resource limits (memory, CPU, or PIDs). The kernel OOM killer terminated the process or Docker refused to start the container.

generic

Workarounds

  1. 90% success Increase the container memory limit: docker run -m 2g
    docker run -m 2g --memory-swap 4g <image> — sets 2GB RAM limit with 4GB total (including swap)

    Sources: https://docs.docker.com/config/containers/resource_constraints/

  2. 85% success Profile the container to find the memory-hungry process
    docker stats <container> to see real-time memory usage; docker exec <container> top to identify the process

    Sources: https://docs.docker.com/config/containers/resource_constraints/

Dead Ends

Common approaches that don't work:

  1. Running the container with --privileged to bypass cgroup limits 85% fail

    Privileged mode does not bypass cgroup memory limits; it grants device access but the OOM killer still enforces memory constraints

  2. Disabling the OOM killer with --oom-kill-disable without setting memory limits 90% fail

    Without memory limits, the container can consume all host memory and freeze the entire system

Error Chain

Leads to:
Preceded by:
Frequently confused with: