搜索
docker 限制内存, 报 not support swap limit capabilities
迷茫
迷茫 2017-04-22 08:55:39
[Docker讨论组]

运行入下面的的命令,

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.
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号