ysicing
V2EX  ›  Docker

docker 容器不使用 swap 内存

  •  
  •   ysicing ·
    ysicing · Jul 24, 2017 · 4075 views
    This topic created in 3390 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
    cephei
    Jul 24, 2017
    1
    宿主上建了 Swap 了吗
    zuolan
    zuolan
    Jul 24, 2017
    2
    ubuntu-stress 是什么镜像?
    ysicing
    ysicing
    OP
    Jul 24, 2017
    3
    @zuolan 就是安装了 stress 的 ubuntu

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