ysicing
V2EX  ›  Docker

docker 容器不使用 swap 内存

  •  
  •   ysicing ·
    ysicing · Jul 24, 2017 · 3721 views
    This topic created in 3240 days ago, the information mentioned may be changed or developed.
    docker run -it --rm -m 100M --memory-swap 200M ubuntu-stress:latest /bin/bash
    # 压测 100M oom 掉了
    root@8b3e0e67c0c2:/# stress --vm 1 --vm-bytes 100M
    stress: info: [12] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
    stress: FAIL: [12] (415) <-- worker 13 got signal 9
    stress: WARN: [12] (417) now reaping child worker processes
    stress: FAIL: [12] (451) failed run completed in 0s
    
    root@8b3e0e67c0c2:/# stress --vm 1 --vm-bytes 50M
    stress: info: [14] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
    

    这应该不科学吧?求解 参考的是这篇文章Docker 资源限制之内存

    Supplement 1  ·  Jul 24, 2017

    是否与这个值(MemorySwappiness)有关

    "MemorySwap": 1073741824,
    "MemorySwappiness": -1,  <== 此值有关
    
    4 replies    2017-07-25 10:04:09 +08:00
    cephei
        1
    cephei  
       Jul 24, 2017
    宿主上建了 Swap 了吗
    zuolan
        2
    zuolan  
       Jul 24, 2017
    ubuntu-stress 是什么镜像?
    ysicing
        3
    ysicing  
    OP
       Jul 24, 2017
    @zuolan 就是安装了 stress 的 ubuntu

    @cephei 建立了啊啊
    cephei
        4
    cephei  
       Jul 25, 2017
    docker stats 看一下资源使用情况吧
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   899 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 19:28 · PVG 03:28 · LAX 12:28 · JFK 15:28
    ♥ Do have faith in what you're doing.