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.
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
- Add the cgroup memory kernel parameters and reboot.
- Confirm the controller is available afterward.
# /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/memoryRun without a memory limit where the controller is absent
- If you cannot change the host kernel, drop
--memoryand rely on other limits.
docker run --rm myorg/api:1.4.2 # no --memory on a host without the controllerHow to prevent it
- Enable the memory cgroup controller on hosts that need limits.
- Verify
/sys/fs/cgroupexposes the memory controller. - Document which runners support memory limits.