From 3aa70c1948e44ab523db0be37a602b63e7eac882 Mon Sep 17 00:00:00 2001 From: Hu Keping Date: Mon, 26 Oct 2015 11:33:51 +0800 Subject: [PATCH] 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 --- api/client/run.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/client/run.go b/api/client/run.go index 260d187cbb..99be7a0677 100644 --- a/api/client/run.go +++ b/api/client/run.go @@ -63,6 +63,10 @@ func (cli *DockerCli) CmdRun(args ...string) error { os.Exit(1) } + if hostConfig.OomKillDisable && hostConfig.Memory == 0 { + fmt.Fprintf(cli.err, "WARNING: Dangerous only disable the OOM Killer on containers but not set the '-m/--memory' option\n") + } + if len(hostConfig.DNS) > 0 { // check the DNS settings passed via --dns against // localhost regexp to warn if they are trying to