docker可以通过启动命令来限制容器可以使用的最大物理内存和swap,但是通常在使用这些命令的时候经常会碰到“WARNING: No swap limit support”警告

大概意思就是不支持swap内存的限制,所以在使用,在国内的腾讯云和阿里云服务器上测试都是报这个警告的。

限制docker容器最大内存使用量

参数:-m 64M --memory-swap=128M

-m 64M 限制了容器运行可以使用的最大物理内存为64M,--memory-swap=128M限制容器可以使用的最大虚拟内存为128M,在出现WARNING: No swap limit support警告时这两个参数是无效的。

解决方法:

1、编辑/etc/default/grub文件。

在GRUB_CMDLINE_LINUX=" ",中并追加 cgroup_enable=memory swapaccount=1

yang@master:~$ cat  /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration' GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity"
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

注:如果GRUB_CMDLINE_LINUX=内有内容,切记不可删除,只需在后面追加cgroup_enable=memory swapaccount=1并用空格和前面的内容分隔开。

2、保存,更新

yang@master:~$  sudo update-grub

3、重启服务器

yang@master:~$ sudo reboot

4、查看

yang@master:~$ docker info
Client:
Context: default
Debug Mode: false
Plugins:
.....
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

 

Docker info 查看报错 WARNING: No swap limit support 解决的更多相关文章

  1. ubuntu中执行docker info出现警告信息WARNING: No memory limit support 或 WARNING: No swap limit support

    docker info 指令报若下错误:WARNING: No memory limit support 或WARNING: No swap limit support 解决方法: 1.打开/etc/ ...

  2. egg 连接 mysql 的 docker 容器,报错:Client does not support authentication protocol requested by server; consider upgrading MySQL client

    egg 连接 mysql 的 docker 容器,报错:Client does not support authentication protocol requested by server; con ...

  3. Docker运行程序报错 WARNING: IPv4 forwarding is disabled. Networking will not work

    WARNING: IPv4 forwarding is disabled. Networking will not work.   第一步:vi /usr/lib/sysctl.d/00-system ...

  4. docker info 警告"WARNING: No swap limit support"

    vim/etc/default/grub 找到 GRUB_CMDLINE_LINUX="" 在双引号里面输入cgroup_enable=memory swapaccount=1 然 ...

  5. centos 6.5安装docker报错(查看报错详细信息--推荐)

    (1)yum安装docker [root@namenode ~]# yum install docker-io (2)启动docker [root@namenode ~]# /etc/init.d/d ...

  6. Docker报错 WARNING: IPv4 forwarding is disabled. Networking will not work.

    问题:创建容器的时候报错WARNING: IPv4 forwarding is disabled. Networking will not work. # docker run -it -p 3000 ...

  7. (TODO:)下载图片,报错:warning: could not load any Objective-C class information from the dyld shared cache. This will significantly reduce the quality of type information available.

    想使用NSInvocationOperation下载图片,然而并没有下载下来, NSData为nil, 还有报错:(打断点就报错) warning: could not load any Object ...

  8. ecstore在MySQL5.7下维护报错WARNING:512 @ ALTER IGNORE TABLE

    ecstore在MySQL5.7下维护报错WARNING:512 @ ALTER IGNORE TABLE 打开 /app/base/lib/application/dbtable.php , 替换A ...

  9. zun 不能创建 docker 容器,报错: datastore for scope "global" is not initialized

    问题:zun不能创建docker容器,报错:datastore for scope "global" is not initialized   解决:修改docker 服务配置文件 ...

  10. 【mysql报错】MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”

    MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”在命令行使用密码不安全警 ...

随机推荐

  1. nginx转发tomcat之https不生效

    1.修改tomcat配置server.xml,让它从请求头中的X-Forwarded-Proto读取 <!-- xpath://Server/Service/Engine/Value --> ...

  2. WampServer3.0服务器端开启ssl认证后重启Apache失败,解决办法

    最近项目中需要访问网站的 https 地址,于是进行部署,什么事情都是想起来简单,做起来难,想着一天就能搞定的事儿,结果前后折腾了三天. 现在把部署的经历记录下来,希望对朋友们有所帮助. 1.在西部数 ...

  3. win10家庭版升级为专业版

    1.选择此电脑点击属性 2.点击更改产品密匙 3.输入产品密匙 4N7JM-CV98F-WY9XX-9D8CF-369TT下一步等待升级重启即可.

  4. windows下搭建nrf52832nordic_ble_sniffer_3.0+wireshark抓包环境

    准备工具 pythone3.7安装包 https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe Wireshark-win64-3. ...

  5. vue.cli的安装配置

    关于旧版本 Vue CLI 的包名称由 vue-cli 改成了 @vue/cli. 如果你已经全局安装了旧版本的 vue-cli(1.x 或 2.x),你需要先通过 npm uninstall vue ...

  6. Redis的不同客户端对比

    Redis 官方推荐的 Java 客户端有Jedis.lettuce 和 Redisson 客户端 简介 优点 缺点 Jedis 提供了比较全面的 Redis 操作 Jedis 简单全面, 支持 pi ...

  7. idea主题插件 ->Atom Material File Icons

    Atom Material File Icons    插件名

  8. Java- 基础知识脑图

  9. 《Makefile中基本字符串替换函数与处理函数的使用参考》

    https://blog.csdn.net/ababab12345/article/details/120723396

  10. Linux Shell开发功能点

    背景 需要操作一批次服务器安装Docker 功能特色 一键执行 bash <(curl -s -L http://server.com/installDocker.sh) MemberNode ...