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 <amurdaca@redhat.com>
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2015-10-13 11:26:27 +02:00 committed by Tibor Vass
parent 65120e8851
commit e9287cd43a
6 changed files with 12 additions and 0 deletions

View File

@ -1389,6 +1389,7 @@ _docker_run() {
--memory-reservation --memory-reservation
--name --name
--net --net
--oom-score-adj
--pid --pid
--publish -p --publish -p
--restart --restart

View File

@ -482,6 +482,7 @@ __docker_subcommand() {
"($help)--name=[Container name]:name: " "($help)--name=[Container name]:name: "
"($help)--net=[Connect a container to a network]:network mode:(bridge none container host)" "($help)--net=[Connect a container to a network]:network mode:(bridge none container host)"
"($help)--oom-kill-disable[Disable OOM Killer]" "($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-all)"{-P,--publish-all}"[Publish all exposed ports]"
"($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports" "($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports"
"($help)--pid=[PID namespace to use]:PID: " "($help)--pid=[PID namespace to use]:PID: "

View File

@ -58,6 +58,7 @@ Creates a new container.
--name="" Assign a name to the container --name="" Assign a name to the container
--net="default" Set the Network mode for 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-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-all=false Publish all exposed ports to random ports
-p, --publish=[] Publish a container's port(s) to the host -p, --publish=[] Publish a container's port(s) to the host
--pid="" PID namespace to use --pid="" PID namespace to use

View File

@ -62,6 +62,7 @@ parent = "smn_cli"
'host': use the host network stack inside the container 'host': use the host network stack inside the container
'NETWORK': connects the container to user-created network using `docker network create` command '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-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-all=false Publish all exposed ports to random ports
-p, --publish=[] Publish a container's port(s) to the host -p, --publish=[] Publish a container's port(s) to the host
--pid="" PID namespace to use --pid="" PID namespace to use

View File

@ -47,6 +47,7 @@ docker-create - Create a new container
[**--name**[=*NAME*]] [**--name**[=*NAME*]]
[**--net**[=*"bridge"*]] [**--net**[=*"bridge"*]]
[**--oom-kill-disable**[=*false*]] [**--oom-kill-disable**[=*false*]]
[**--oom-score-adj**[=*0*]]
[**-P**|**--publish-all**[=*false*]] [**-P**|**--publish-all**[=*false*]]
[**-p**|**--publish**[=*[]*]] [**-p**|**--publish**[=*[]*]]
[**--pid**[=*[]*]] [**--pid**[=*[]*]]
@ -234,6 +235,9 @@ This value should always larger than **-m**, so you should always use this with
**--oom-kill-disable**=*true*|*false* **--oom-kill-disable**=*true*|*false*
Whether to disable OOM Killer for the container or not. 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* **-P**, **--publish-all**=*true*|*false*
Publish all exposed ports to random ports on the host interfaces. The default is *false*. Publish all exposed ports to random ports on the host interfaces. The default is *false*.

View File

@ -48,6 +48,7 @@ docker-run - Run a command in a new container
[**--name**[=*NAME*]] [**--name**[=*NAME*]]
[**--net**[=*"bridge"*]] [**--net**[=*"bridge"*]]
[**--oom-kill-disable**[=*false*]] [**--oom-kill-disable**[=*false*]]
[**--oom-score-adj**[=*0*]]
[**-P**|**--publish-all**[=*false*]] [**-P**|**--publish-all**[=*false*]]
[**-p**|**--publish**[=*[]*]] [**-p**|**--publish**[=*[]*]]
[**--pid**[=*[]*]] [**--pid**[=*[]*]]
@ -346,6 +347,9 @@ and foreground Docker containers.
**--oom-kill-disable**=*true*|*false* **--oom-kill-disable**=*true*|*false*
Whether to disable OOM Killer for the container or not. 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* **-P**, **--publish-all**=*true*|*false*
Publish all exposed ports to random ports on the host interfaces. The default is *false*. Publish all exposed ports to random ports on the host interfaces. The default is *false*.