Docker警告CGroup交换限制,memory.use_hierarchy [英] Docker warning on cgroup swap limit, memory.use_hierarchy

查看:189
本文介绍了Docker警告CGroup交换限制,memory.use_hierarchy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从'sudo docker -d'收到此警告:

I am getting this warning from 'sudo docker -d':

警告:您的内核不支持cgroup交换限制.

WARNING: Your kernel does not support cgroup swap limit.

即使按照以下步骤操作(如链接所示):

even after following the steps (as in this link):

  • 修改/etc/default/grub中的以下行(我都做了很好的测量)

  • modify below lines in /etc/default/grub (I did both for good measure)

RUB_CMDLINE_LINUX_DEFUALT ="cgroup_enable =内存swapaccount = 1"GRUB_CMDLINE_LINUX ="cgroup_enable =内存swapaccount = 1"

RUB_CMDLINE_LINUX_DEFUALT="cgroup_enable=memory swapaccount=1" GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

  • ,然后通过以下方式更新-grub/重新启动

  • and then update-grub/reboot via

    sudo update-grub;sudo重新启动

    sudo update-grub; sudo reboot

  • 我的问题是:

    1)我应该担心此警告吗?

    我想应该是因为我试图在强制执行内存限制很重要的用例中使用docker容器.

    I think I should be because I am trying to use docker containers in a use case where enforcing memory limits is important.

    2)更改内存use_hierarchy设置是一个好主意吗?-或-解决此问题的最佳方法是什么?

    我在"dmesg"中看到此警告.我不确定尝试将use_hierarchy设置更改为"1"(也不是确切地做到这一点)是否是个好主意

    I see this warning in 'dmesg'. I am not sure if it is a good idea to try to change the use_hierarchy setting to '1' (nor how exactly to do this)

    cgroup:内存"要求在根目录上将use_hierarchy设置为1."

    cgroup: "memory" requires setting use_hierarchy to 1 on the root."

    或者,是否有更好的方法来解决此问题?我只是在这里开枪,也许内核升级会有所帮助吗?我看到一些3.16内核升级是可能的.

    Or, is there some better way to fix this? I'm just firing wild shots here, perhaps a kernel upgrade would help? I see some 3.16 kernel upgrades are possible.

    环境:我正在使用Docker版本1.0.1运行Ubuntu 14.04 x64(内核:3.13.0-43-generic x86_64)

    Environment: I am running Ubuntu 14.04 x64 (kernel: 3.13.0-43-generic x86_64) with docker version 1.0.1

    其他说明:我还阅读了有关类似docker/cgroup错误的其他在线帮助文​​章,其中说安装apparmor_parser可以解决该问题.但是,在我的系统上,安装了apparmor并似乎可以正常启动(每个dmesg).另外,该文件存在:/sbin/apparmor_parser

    Other notes: I have read other online help articles about similar docker/cgroup errors that say installing apparmor_parser fixes it. However, on my system, apparmor is installed and appears to be started up just fine (per dmesg). Also, this file exists: /sbin/apparmor_parser

    此外,我对Linux服务器上的管理任务还是比较陌生的.

    Also, I'm rather new to admin tasks on linux servers.

    推荐答案

    cgroup交换限制非常重要,如果您正在使用交换并且要实施包括内存和交换的内存限制.我的M/C没有交换功能,因此我从未启用它.

    cgroup swap limit is important if you are using swap and want to enforce memory limit that includes both memory and swap. I have m/c without swap, so I never enabled it.

    use_hierarchy很有用.例如,在use_hierarchy = 1的情况下,/sys/fs/cgroup/memory/parent将报告该cgroup下的进程以及所有子cgroup(例如/sys/fs/cgroup/memory/parent/child)使用的内存.这始终是启用的有用设置.但是默认情况下,在大多数操作系统上均未启用该功能.

    use_hierarchy is useful if you want reported memory usage to include memory reported by all subcgroups. eg with use_hierarchy=1, /sys/fs/cgroup/memory/parent will report memory used by processes under that cgroup and also of any subcgroups (like /sys/fs/cgroup/memory/parent/child). This is always a useful setting to enable. But its not enabled by default on most OS.

    总而言之,没有这两个设置,您的Docker容器将可以正常工作.启用这些功能会给您带来一些额外的好处-尤其是.如果您关心限制交换的使用并获得准确的内存报告.

    In summary, your docker containers will work fine without both of these settings. Enabling these gives you some extra benefit - esp. if you care about limit swap use and getting accurate memory reporting.

    这篇关于Docker警告CGroup交换限制,memory.use_hierarchy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆