Docker 运行镜像警告Your kernel does not support swap limit capabilities解决方案

本文介绍如何通过修改GRUB启动参数来解决运行Docker时遇到的关于内核不支持cgroup交换限制的警告。通过调整GRUB_CMDLINE_LINUX值,启用内存和交换会计功能,避免Docker运行时出现性能限制警告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这是因为主机上默认不启用cgroup来控制swap分区,可以参考docker官方的相应文档,修改grub启动参数。

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.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值