V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ysicing
V2EX  ›  Docker

docker 容器不使用 swap 内存

  •  
  •   ysicing ·
    ysicing · 2017-07-24 16:10:38 +08:00 · 3160 次点击
    这是一个创建于 2465 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 资源限制之内存

    第 1 条附言  ·  2017-07-24 17:17:18 +08:00

    是否与这个值(MemorySwappiness)有关

    "MemorySwap": 1073741824,
    "MemorySwappiness": -1,  <== 此值有关
    
    4 条回复    2017-07-25 10:04:09 +08:00
    cephei
        1
    cephei  
       2017-07-24 16:47:02 +08:00
    宿主上建了 Swap 了吗
    zuolan
        2
    zuolan  
       2017-07-24 16:54:50 +08:00
    ubuntu-stress 是什么镜像?
    ysicing
        3
    ysicing  
    OP
       2017-07-24 17:11:27 +08:00
    @zuolan 就是安装了 stress 的 ubuntu

    @cephei 建立了啊啊
    cephei
        4
    cephei  
       2017-07-25 10:04:09 +08:00
    docker stats 看一下资源使用情况吧
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3087 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 14:56 · PVG 22:56 · LAX 07:56 · JFK 10:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.