zoukankan      html  css  js  c++  java
  • docker动态修改容器限制

    动态修改配置用docker update

    语法介绍

    [root@localhost ~]# docker update --help
    
    Usage:  docker update [OPTIONS] CONTAINER [CONTAINER...]
    
    Update configuration of one or more containers
    
    Options:
          --blkio-weight uint16        Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
          --cpu-period int             Limit CPU CFS (Completely Fair Scheduler) period
          --cpu-quota int              Limit CPU CFS (Completely Fair Scheduler) quota
          --cpu-rt-period int          Limit the CPU real-time period in microseconds
          --cpu-rt-runtime int         Limit the CPU real-time runtime in microseconds
      -c, --cpu-shares int             CPU shares (relative weight)
          --cpus decimal               Number of CPUs
          --cpuset-cpus string         CPUs in which to allow execution (0-3, 0,1)
          --cpuset-mems string         MEMs in which to allow execution (0-3, 0,1)
          --kernel-memory bytes        Kernel memory limit
      -m, --memory bytes               Memory limit
          --memory-reservation bytes   Memory soft limit
          --memory-swap bytes          Swap limit equal to memory plus swap: '-1' to enable unlimited swap
          --restart string             Restart policy to apply when a container exits

    可以通过docker stats 查看当前容器情况

    docker stats --no-stream    添加 --no-stream参数,不会实时刷新显示资源使用情况。

    docker stats 显示全部容器

    docker stats containername 显示指定容器

    现在试验修改mongodb的内存限制

    操作失败了,提示信息:内存限制应小于已设置的memoryswap限制,同时更新memoryswap

    注意:

    指定限制内存大小并且设置 memory-swap 值为 -1,表示容器程序使用内存受限,而 swap 空间使用不受限制,宿主 swap 支持使用多少则容器即可使用多少。

    如果不添加–memory-swap选项,则表示容器中程序可以使用8G内存和8Gswap内存,默认情况下,–memory-swap 会被设置成 memory 的 2倍。-m 为物理内存上限,而 –memory-swap 则是 memory + swap 之和,当压测值是 –memory-swap 上限时,则容器中的进程会被直接 OOM kill。

  • 相关阅读:
    MT4系统自带指标代码
    [转载]一个鼠标键盘控制两台甚至多台主机的方法
    国内外证券交易系统开发平台比较
    Win8系统下MT4不能添加指标无法找到技术指标
    Unable to locate package错误解决办法
    ubuntu 常见错误--Could not get lock /var/lib/dpkg/lock
    ubuntu永久修改主机名
    Ant之build.xml详解
    Memory和Storage有什么区别?
    ubuntu下创建eclipse桌面快捷方式
  • 原文地址:https://www.cnblogs.com/ningyouyou/p/15751673.html
Copyright © 2011-2022 走看看