docker 限制記憶體, 報 not support swap limit capabilities
迷茫
迷茫 2017-04-22 08:55:39
0
1
959

運行入下麵的的命令,

docker run -it --rm -m 128m stress --vm 1 --vm-bytes 400M --vm-hang 0

創建一個容器,測試Docker對容器內存的限製。容器係統鏡像是ubuntu 14.04.2。運行後,有如下提示

WARNING: Your kernel does not support swap limit capabilities, memory limited without swap.

容器可以正常運行,並沒有因為內存溢出而終結。

求大牛幫忙解釋一下原因。

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

全部回覆(1)
黄舟

https://docs.docker.com/installation/ubuntulinux/
這個問題很好搞定。

Adjust memory and swap accounting
When users run Docker, they may see these messages when working with an image:

WARNING: Your kernel does not support cgroup swap limit. WARNING: Your
kernel does not support swap limit capabilities. Limitation discarded.
To prevent these messages, enable memory and swap accounting on your system. To enable these on system using GNU GRUB (GNU GRand Unified Bootloader), do the following.

Log into Ubuntu as a user with sudo privileges.

Edit the /etc/default/grub file.

Set the GRUB_CMDLINE_LINUX value as follows:

GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
Save and close the file.

Update GRUB.

$ sudo update-grub
Reboot your system.
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板