From e9287cd43a8217b19f8105306986d91069b40983 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Tue, 13 Oct 2015 11:26:27 +0200 Subject: [PATCH] Add OomScoreAdj to configure container oom killer preferences libcontainer v0.0.4 introduces setting `/proc/self/oom_score_adj` to better tune oom killing preferences for container process. This patch simply integrates OomScoreAdj libcontainer's config option and adjust the cli with this new option. Signed-off-by: Antonio Murdaca Signed-off-by: Antonio Murdaca --- contrib/completion/bash/docker | 1 + contrib/completion/zsh/_docker | 1 + docs/reference/commandline/create.md | 1 + docs/reference/commandline/run.md | 1 + man/docker-create.1.md | 4 ++++ man/docker-run.1.md | 4 ++++ 6 files changed, 12 insertions(+) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index ced3724e53..90c21a9ad4 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -1389,6 +1389,7 @@ _docker_run() { --memory-reservation --name --net + --oom-score-adj --pid --publish -p --restart diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index cde026b7eb..e5a3d9ce1c 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -482,6 +482,7 @@ __docker_subcommand() { "($help)--name=[Container name]:name: " "($help)--net=[Connect a container to a network]:network mode:(bridge none container host)" "($help)--oom-kill-disable[Disable OOM Killer]" + "($help)--oom-score-adj[Tune the host's OOM preferences for containers (accepts -1000 to 1000)]" "($help -P --publish-all)"{-P,--publish-all}"[Publish all exposed ports]" "($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports" "($help)--pid=[PID namespace to use]:PID: " diff --git a/docs/reference/commandline/create.md b/docs/reference/commandline/create.md index 036fdc9806..e5bc7b5ab2 100644 --- a/docs/reference/commandline/create.md +++ b/docs/reference/commandline/create.md @@ -58,6 +58,7 @@ Creates a new container. --name="" Assign a name to the container --net="default" Set the Network mode for the container --oom-kill-disable=false Whether to disable OOM Killer for the container or not + --oom-score-adj=0 Tune the host's OOM preferences for containers (accepts -1000 to 1000) -P, --publish-all=false Publish all exposed ports to random ports -p, --publish=[] Publish a container's port(s) to the host --pid="" PID namespace to use diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index 87cef35445..794e37e8e3 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -62,6 +62,7 @@ parent = "smn_cli" 'host': use the host network stack inside the container 'NETWORK': connects the container to user-created network using `docker network create` command --oom-kill-disable=false Whether to disable OOM Killer for the container or not + --oom-score-adj=0 Tune the host's OOM preferences for containers (accepts -1000 to 1000) -P, --publish-all=false Publish all exposed ports to random ports -p, --publish=[] Publish a container's port(s) to the host --pid="" PID namespace to use diff --git a/man/docker-create.1.md b/man/docker-create.1.md index dc6891da62..961aa85cbb 100644 --- a/man/docker-create.1.md +++ b/man/docker-create.1.md @@ -47,6 +47,7 @@ docker-create - Create a new container [**--name**[=*NAME*]] [**--net**[=*"bridge"*]] [**--oom-kill-disable**[=*false*]] +[**--oom-score-adj**[=*0*]] [**-P**|**--publish-all**[=*false*]] [**-p**|**--publish**[=*[]*]] [**--pid**[=*[]*]] @@ -234,6 +235,9 @@ This value should always larger than **-m**, so you should always use this with **--oom-kill-disable**=*true*|*false* Whether to disable OOM Killer for the container or not. +**--oom-score-adj**="" + Tune the host's OOM preferences for containers (accepts -1000 to 1000) + **-P**, **--publish-all**=*true*|*false* Publish all exposed ports to random ports on the host interfaces. The default is *false*. diff --git a/man/docker-run.1.md b/man/docker-run.1.md index 7c56790f9f..1e1c7f0e0d 100644 --- a/man/docker-run.1.md +++ b/man/docker-run.1.md @@ -48,6 +48,7 @@ docker-run - Run a command in a new container [**--name**[=*NAME*]] [**--net**[=*"bridge"*]] [**--oom-kill-disable**[=*false*]] +[**--oom-score-adj**[=*0*]] [**-P**|**--publish-all**[=*false*]] [**-p**|**--publish**[=*[]*]] [**--pid**[=*[]*]] @@ -346,6 +347,9 @@ and foreground Docker containers. **--oom-kill-disable**=*true*|*false* Whether to disable OOM Killer for the container or not. +**--oom-score-adj**="" + Tune the host's OOM preferences for containers (accepts -1000 to 1000) + **-P**, **--publish-all**=*true*|*false* Publish all exposed ports to random ports on the host interfaces. The default is *false*.