Skip to content
Latchkey

Docker "cgroup memory limit not supported" runtime error in CI

Setting --memory requires the kernel memory cgroup controller to be available and mounted. When it is missing - a kernel built without it, or a cgroup hierarchy where the memory controller is not enabled - Docker warns or fails that the memory limit is not supported and the limit is ignored or refused.

What this error means

A docker run --memory start warns or fails that the kernel does not support memory limit capabilities, or the memory cgroup is not mounted.

docker
WARNING: Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.

Common causes

Memory cgroup controller disabled

The kernel boot parameters or cgroup v1/v2 setup did not enable the memory controller.

cgroup memory not mounted

On some minimal hosts the memory cgroup hierarchy is not mounted, so limits cannot be applied.

How to fix it

Enable the memory cgroup at boot

  1. Add the cgroup memory kernel parameters and reboot.
  2. Confirm the controller is available afterward.
Terminal
# /etc/default/grub
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
# then: sudo update-grub && sudo reboot
cat /sys/fs/cgroup/memory.max 2>/dev/null || ls /sys/fs/cgroup/memory

Run without a memory limit where the controller is absent

  1. If you cannot change the host kernel, drop --memory and rely on other limits.
Terminal
docker run --rm myorg/api:1.4.2   # no --memory on a host without the controller

How to prevent it

  • Enable the memory cgroup controller on hosts that need limits.
  • Verify /sys/fs/cgroup exposes the memory controller.
  • Document which runners support memory limits.

Frequently asked questions

What causes ""memory limit not supported""?
The kernel boot parameters or cgroup v1/v2 setup did not enable the memory controller.
How do I fix "memory limit not supported"?
Enable the memory cgroup at boot

Related guides

References

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