【问题标题】:Why docker run `--oom-kill-disable` is not effective , but `echo 1 > memory.oom_control` is effective in myself System!为什么 docker run `--oom-kill-disable` 不生效,但是 `echo 1 > memory.oom_control` 在我自己的系统中生效!
【发布时间】:2020-03-18 07:30:16
【问题描述】:

当我为docker run --oom-kill-disable运行一个容器时,它是无效的;但是当我“echo 1 > memory.oom_control”时,它是有效的。

docker version:
Client:
 Version:   17.12.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built: Wed Dec 27 20:05:38 2017
 OS/Arch:   linux/amd64

Server:
 Engine:
  Version:  17.12.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   c97c6d6
  Built:    Wed Dec 27 20:12:29 2017
  OS/Arch:  linux/amd64
  Experimental: false
1.sudo docker run -it --memory=100M --oom-kill-disable MyselfImage /bin/bash
2.stress --vm 1 --vm-bytes 200M #stress process is killed
stress: info: [42] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
stress: FAIL: [42] (415) <-- worker 43 got signal 9
stress: WARN: [42] (417) now reaping child worker processes
stress: FAIL: [42] (451) failed run completed in 1s
3.echo 1 > /sys/fs/cgroup/memory/docker/XXX/memory.oom_control
4.stress --vm 1 --vm-bytes 200M #stress process is not killed
stress: info: [42] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
...

为什么--oom-kill-disable参数没有改变memory.oom_control文件。

【问题讨论】:

  • 似乎是一个错误......在19.03.7 中,一切都按预期工作(Arch)。你能尝试在不同的环境中测试它吗?
  • @DanilaKiver 好的,我会试试的!

标签: docker cgroups


【解决方案1】:

当我尝试 docker 19.03.7 时,它可以工作!所以,这个问题是我的 docker(17.12.0-ce) 中的一个错误

Client: Docker Engine - Community
 Version:           19.03.7
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        7141c199a2
 Built:             Wed Mar  4 01:19:42 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.7
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       7141c199a2
  Built:            Wed Mar  4 01:19:50 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-05
    相关资源
    最近更新 更多