Skip to content

Commit 3aa70c1

Browse files
committed
Warning out when disalbe oom killer but not set the memory limit
It is always the best practice that only disable the OOM Killer where you also set the `-m/--memory` option, otherwise it's dangerous. Signed-off-by: Hu Keping <hukeping@huawei.com>
1 parent 75128c4 commit 3aa70c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/client/run.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ func (cli *DockerCli) CmdRun(args ...string) error {
6363
os.Exit(1)
6464
}
6565

66+
if hostConfig.OomKillDisable && hostConfig.Memory == 0 {
67+
fmt.Fprintf(cli.err, "WARNING: Dangerous only disable the OOM Killer on containers but not set the '-m/--memory' option\n")
68+
}
69+
6670
if len(hostConfig.DNS) > 0 {
6771
// check the DNS settings passed via --dns against
6872
// localhost regexp to warn if they are trying to

0 commit comments

Comments
 (0)