diff --git a/docs/reference/commandline/create.md b/docs/reference/commandline/create.md index 3fa795abfc..2e0e591a97 100644 --- a/docs/reference/commandline/create.md +++ b/docs/reference/commandline/create.md @@ -57,6 +57,7 @@ Creates a new container. --privileged=false Give extended privileges to this container --read-only=false Mount the container's root filesystem as read only --restart="no" Restart policy (no, on-failure[:max-retry], always) + --memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. --security-opt=[] Security options -t, --tty=false Allocate a pseudo-TTY -u, --user="" Username or UID diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index 5e700845a3..147bf70495 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -58,6 +58,7 @@ weight=1 --read-only=false Mount the container's root filesystem as read only --restart="no" Restart policy (no, on-failure[:max-retry], always) --rm=false Automatically remove the container when it exits + --memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. --security-opt=[] Security Options --sig-proxy=true Proxy received signals to the process -t, --tty=false Allocate a pseudo-TTY diff --git a/docs/reference/run.md b/docs/reference/run.md index 2152947c1a..48662ccdd1 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -514,6 +514,7 @@ container: --cpu-quota=0: Limit the CPU CFS (Completely Fair Scheduler) quota --blkio-weight=0: Block IO weight (relative weight) accepts a weight value between 10 and 1000. --oom-kill-disable=true|false: Whether to disable OOM Killer for the container or not. + --memory-swappiness="": Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. ### Memory constraints @@ -611,6 +612,20 @@ The following example, illustrates a dangerous way to use the flag: The container has unlimited memory which can cause the host to run out memory and require killing system processes to free memory. +### Swappiness constraint + +By default, a container's kernel can swap out a percentage of anonymous pages. +To set this percentage for a container, specify a `--memory-swappiness` value +between 0 and 100. A value of 0 turns off anonymous page swapping. A value of +100 sets all anonymous pages as swappable. + +For example, you can set: + + $ docker run -ti --memory-swappiness=0 ubuntu:14.04 /bin/bash + +Setting the `--memory-swappiness` option is helpful when you want to retain the +container's working set and to avoid swapping performance penalties. + ### CPU share constraint By default, all containers get the same proportion of CPU cycles. This proportion diff --git a/man/docker-create.1.md b/man/docker-create.1.md index a41ca04bc1..0bde6271e8 100644 --- a/man/docker-create.1.md +++ b/man/docker-create.1.md @@ -48,6 +48,7 @@ docker-create - Create a new container [**--read-only**[=*false*]] [**--restart**[=*RESTART*]] [**--security-opt**[=*[]*]] +[**--memory-swappiness**[=*MEMORY-SWAPPINESS*]] [**-t**|**--tty**[=*false*]] [**-u**|**--user**[=*USER*]] [**-v**|**--volume**[=*[]*]] @@ -225,6 +226,9 @@ This value should always larger than **-m**, so you should always use this with **--security-opt**=[] Security Options +**--memory-swappiness**="" + Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. + **-t**, **--tty**=*true*|*false* Allocate a pseudo-TTY. The default is *false*. diff --git a/man/docker-run.1.md b/man/docker-run.1.md index c81f3f8e3e..cdecee8461 100644 --- a/man/docker-run.1.md +++ b/man/docker-run.1.md @@ -51,6 +51,7 @@ docker-run - Run a command in a new container [**--rm**[=*false*]] [**--security-opt**[=*[]*]] [**--sig-proxy**[=*true*]] +[**--memory-swappiness**[=*MEMORY-SWAPPINESS*]] [**-t**|**--tty**[=*false*]] [**-u**|**--user**[=*USER*]] [**-v**|**--volume**[=*[]*]] @@ -371,6 +372,9 @@ its root filesystem mounted as read only prohibiting any writes. **--sig-proxy**=*true*|*false* Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is *true*. +**--memory-swappiness**="" + Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. + **-t**, **--tty**=*true*|*false* Allocate a pseudo-TTY. The default is *false*.