Loading

树莓派docker: Your kernel does not support memory limit capabilities or the cgroup is not mounted

现象

希望针对已启动ubuntu16.04容器进行内存限制,运行后报错

$ docker update ubuntu:16.04 --memory-swap -1 -m 512M
ubuntu:16.04 
Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.

解决

显然,docker提示系统不支持cgroup内存限制,需要手动开启。
解决方案是在/boot/cmdline.txt尾部加入 cgroup_enable=memory cgroup_memory=1后重启
再次运行改动已生效

$ docker stats
CONTAINER ID        NAME                CPU %               MEM USAGE / LIMIT   MEM %               NET I/O             BLOCK I/O           PIDS
9e57861d5ac7        ubuntu              1.12%               5.113MiB / 512MiB   0.73%               0B / 0B             0B / 0B             38

参考

raspberry pi - Raspbian docker: Error response from daemon: cgroups: memory cgroup not supported on this system: unknown - Stack Overflow

posted @ 2020-12-27 22:16  azureology  阅读(2542)  评论(0)    收藏  举报