浏览代码

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>
Hu Keping 9 年之前
父节点
当前提交
3aa70c1948
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      api/client/run.go

+ 4 - 0
api/client/run.go

@@ -63,6 +63,10 @@ func (cli *DockerCli) CmdRun(args ...string) error {
 		os.Exit(1)
 		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 {
 	if len(hostConfig.DNS) > 0 {
 		// check the DNS settings passed via --dns against
 		// check the DNS settings passed via --dns against
 		// localhost regexp to warn if they are trying to
 		// localhost regexp to warn if they are trying to