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. 容器之 docker的监控平台(prometheus + Grafana)

    cAdvisor (Container Advisor) :用于收集正在运行的容器资源使用和性能信息.https://github.com/google/cadvisor Prometheus(普罗米 ...

  2. flask中的线程隔离技术

    一.引入: 在无线程隔离情况下,通过线程调用函数,函数内部改变传入对象的属性值(排除非线程安全情况),都将更改传入的对象属性 1 import threading 2 3 class TestThre ...

  3. Vue中的样式作用域

    介绍对于Vue样式作用域的介绍 对于所有组件中的Css都是通用的 在未指定作用域之前 在A组件中定义的 {.h1{color:red}} 同样会在b组件中生效 如果在B组件中也定义了 h1元素. 虽然 ...

  4. PHP二维数组根据某个元素(key)去重

    /** * 二维数组根据key去重复 * @param $arr * @param $key * @return array */ function arrayUniqueness($arr,$key ...

  5. C# 变量和表达式

    变量的命名: 第一个字符必须是字母.下划线或@: 其后的字符可以是字母.下划线或数字. 注意:区分大小写. 变量的类型: 数值类型 1.整数类型 byte.short.int.long sbyte.u ...

  6. ARM的发展史以及架构解析

    本文从ARM的发展历史着手,以S3C2440为例与51单片机进行对比分析,详细解析了ARM架构. 先来谈一下ARM的发展史:1978年12月5日,物理学家Hermann Hauser和工程师Chris ...

  7. 三、核心实战-服务Service-Ingress

    Service 将一组Pods公开为网络服务的抽象方法. 暴露deployment只能在集群内访问是ClusterIP,可以集群外访问是NodePort,默认端口分配是30000-32767之间 ku ...

  8. GoLand 和 Pycharm的 快捷键设置与常用插件

    GoLand 插件 Gopher 美化进度条,让等待更优雅. CodeGlance pro 旁边浏览框. 快捷键设置 删除行: ctrl + L 重新格式化代码 ctrl + K 开始新行 ctrl ...

  9. vue-cli2.0 项目前端不能用IP局域网访问,只能localhost访问

    解决办法1.config/index.js  修改 host:'localhost'为'0.0.0.0' 解决办法2.package.json 修改启动配置 -- host  0.0.0.0 优化终端 ...

  10. SqlServer的主键和外键

    SqlServer在创建表时要有 完整性约束(主键)和参照性约束(外键) 1.在建表时创建主键 第一种方法: 第二种方法: 联合主键,即2个主键,sid和cid 2.如果表已经存在,需要创建主键 外键