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. 在TMOS系统中添加按键检测功能

    目录 TMOS系统中自带有按键检测轮询功能,默认100ms检测一次,在debug时很有帮助.不过在需要低功耗休眠的前提下,检测按键需要频繁唤醒,影响功耗,故多数BLE的工程都没有用到这个功能.代码贴在 ...

  2. css节流

    众所周知,函数节流(throttle)是 JS 中一个非常常见的优化手段,可以有效避免函数过于频繁的执行. 举个例子:一个保存按钮,为了避免重复提交或者服务器考虑,往往需要对点击行为做一定的限制,比如 ...

  3. web基础(7): JavaScript 简介/语法

    chapter4 JS简介 JS 可以实现表单验证(比如填写简历时,必要的项目是否已经填写).返回顶部.小游戏.网页特效等. JS 的开发工具 Hbuilder 官网www.dcloud.io, 能快 ...

  4. Postman中的测试脚本(Test scripts)

    一.postman测试脚本 测试脚本是在发送请求之后运行的,并且已经从服务器接收到响应. 二.测试举例 1.设置环境变量 pm.environment.set("variable_key&q ...

  5. Amd,Cmd, Commonjs, ES6 import/export的异同点

    Amd,Cmd, Commonjs, ES6 import/export等均是模块化方案 1.Commonjs使用在Nodejs上,加载模块是同步的. 2.Amd是requirejs在推广过程中对模块 ...

  6. apk文件结构

    APK (Android Package) 文件,是一个后缀名为.apk的压缩文件,APK文件中包含了一个Android应用程序的所有内容,是Android平台用于安装应用程序的文件. assets  ...

  7. vue.cli的安装配置

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

  8. 浅析sleep()方法与wait()方法

    为什么 wait() 方法不定义在 Thread 中?   wait() 是让获得对象锁的线程实现等待,会自动释放当前线程占有的对象锁.每个对象(Object)都拥有对象锁,既然要释放当前线程占有的对 ...

  9. 剑指 Offer II 回溯法

    086. 分割回文子字符串 用substr枚举 因为是连续的 不是放与不放的问题 class Solution { public: vector<vector<string>> ...

  10. C# 字符串数组去重(去除数组中重复元素)

    1. 去重distinct()或者GroupBy(p => p).Select(p => p.Key),去重的对象都需要为数组,具体看代码 string itemfileids = &qu ...