树莓派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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM