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. 福音---Mysql数据库Schema快速生成

    数据库工具--Navicat Premium 参考链接:https://jingyan.baidu.com/article/ea24bc395231e49b62b33183.html 以下是数据库sq ...

  2. C语言利用union 和 struct 进行位拆分

    #include <stdlib.h> typedef unsigned char uint8_t; union wate_temp{ struct { uint8_t wate_temp ...

  3. python_异常处理(try except)

    1,异常捕获 异常捕获的字段为python解释报错的最后一行的第一个单词.使用try方法,程序报错时,可以使用except方法匹配报错的异常关键字,继续except下方定义的代码,从而保证代码可以正常 ...

  4. 关于XAF中ListView慢的总结与改善

    关于XAF中ListView慢的总结与改善: 一.数据访问模式改善:ListView中DataAccessMode中的改变:默认模式是Client,这在大多数情况下,适当的使用Server,Serve ...

  5. 微积分 I 笔记

    1.1 集合 这一节复习了高中关于集合的基础知识 介绍了一些新的概念 笛卡尔积 (Cartesian Product) 集合 \(X\) 与 \(Y\) 的笛卡尔积 (直积) \(X \times Y ...

  6. 读取excel等文件根据注解自动装填为实体类

    问题:以前每次读取excel 都是根据第几列来装填实体类里面的属性.写起来很麻烦.还要判断. 思路: 1.因为每次读取excel 或者word表格 都能得到是第几列的数据,那么可以知道每列数据的ind ...

  7. springboot aop本地缓存防止重复提交

    实现原理: 自定义防止重复提交标记(@RepeatSubmit). 对需要防止重复提交的Congtroller里的mapping方法加上该注解. 新增Aspect切入点,为@RepeatSubmitA ...

  8. 剑指 Offer II 动态规划

    088. 爬楼梯的最少成本 class Solution { public: int minCostClimbingStairs(vector<int>& cost) { int ...

  9. ctfshow web入门 命令执行 web58-71

    都是 POST传递参数 执行 eval() 函数 web58 if(isset($_POST['c'])){ $c= $_POST['c']; eval($c); }else{ highlight_f ...

  10. 超棒的良心工具-OCR工具集

    使用平台:Windows 虽然是OCR工具,但多了一个"集"字,原因在于该软件内置了搜狗网络OCR.本地离线OCR,不用key,还原天若OCR操作. 一句话:免去申请注册key登录 ...