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