问题
When I run one container for docker run --oom-kill-disable, it is not effective; But when I "echo 1 > memory.oom_control", it is effective.
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
...
Why the memory.oom_control file is not changed by --oom-kill-disable
param.
回答1:
When I try docker 19.03.7, it works! so, this question is a bug in my 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
来源:https://stackoverflow.com/questions/60735110/why-docker-run-oom-kill-disable-is-not-effective-but-echo-1-memory-oom