diff --git a/api/client/build.go b/api/client/build.go index 63bcfa369a..79b5e76c66 100644 --- a/api/client/build.go +++ b/api/client/build.go @@ -49,7 +49,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error { pull := cmd.Bool([]string{"-pull"}, false, "Always attempt to pull a newer version of the image") dockerfileName := cmd.String([]string{"f", "-file"}, "", "Name of the Dockerfile (Default is 'PATH/Dockerfile')") flMemoryString := cmd.String([]string{"m", "-memory"}, "", "Memory limit") - flMemorySwap := cmd.String([]string{"-memory-swap"}, "", "Total memory (memory + swap), '-1' to disable swap") + flMemorySwap := cmd.String([]string{"-memory-swap"}, "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") flShmSize := cmd.String([]string{"-shm-size"}, "", "Size of /dev/shm, default value is 64MB") flCPUShares := cmd.Int64([]string{"#c", "-cpu-shares"}, 0, "CPU shares (relative weight)") flCPUPeriod := cmd.Int64([]string{"-cpu-period"}, 0, "Limit the CPU CFS (Completely Fair Scheduler) period") diff --git a/docs/reference/commandline/build.md b/docs/reference/commandline/build.md index eab0cb7e31..adc94f53b7 100644 --- a/docs/reference/commandline/build.md +++ b/docs/reference/commandline/build.md @@ -27,7 +27,7 @@ parent = "smn_cli" --help Print usage --isolation="" Container isolation technology -m, --memory="" Memory limit for all build containers - --memory-swap="" Total memory (memory + swap), `-1` to disable swap + --memory-swap="" A positive integer equal to memory plus swap. Specify -1 to enable unlimited swap. --no-cache Do not use cache when building the image --pull Always attempt to pull a newer version of the image -q, --quiet Suppress the build output and print image ID on success diff --git a/docs/reference/commandline/create.md b/docs/reference/commandline/create.md index d6a9cc53d2..0a5e24790b 100644 --- a/docs/reference/commandline/create.md +++ b/docs/reference/commandline/create.md @@ -57,7 +57,7 @@ Creates a new container. -m, --memory="" Memory limit --mac-address="" Container MAC address (e.g. 92:d0:c6:0a:29:33) --memory-reservation="" Memory soft limit - --memory-swap="" Total memory (memory + swap), '-1' to disable swap + --memory-swap="" A positive integer equal to memory plus swap. Specify -1 to enable unlimited swap. --memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. --name="" Assign a name to the container --net="bridge" Connect a container to a network diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index 89243c6bf3..c42ca23e58 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -56,7 +56,7 @@ parent = "smn_cli" -m, --memory="" Memory limit --mac-address="" Container MAC address (e.g. 92:d0:c6:0a:29:33) --memory-reservation="" Memory soft limit - --memory-swap="" Total memory (memory + swap), '-1' to disable swap + --memory-swap="" A positive integer equal to memory plus swap. Specify -1 to enable unlimited swap. --memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. --name="" Assign a name to the container --net="bridge" Connect a container to a network diff --git a/man/docker-build.1.md b/man/docker-build.1.md index 3decabe174..91f15fe0d4 100644 --- a/man/docker-build.1.md +++ b/man/docker-build.1.md @@ -19,7 +19,7 @@ docker-build - Build a new image from the source code at PATH [**--rm**[=*true*]] [**-t**|**--tag**[=*[]*]] [**-m**|**--memory**[=*MEMORY*]] -[**--memory-swap**[=*MEMORY-SWAP*]] +[**--memory-swap**[=*LIMIT*]] [**--shm-size**[=*SHM-SIZE*]] [**--cpu-period**[=*0*]] [**--cpu-quota**[=*0*]] @@ -92,8 +92,14 @@ set as the **URL**, the repository is cloned locally and then sent as the contex **-m**, **--memory**=*MEMORY* Memory limit -**--memory-swap**=*MEMORY-SWAP* - Total memory (memory + swap), '-1' to disable swap. +**--memory-swap**=*LIMIT* + A limit value equal to memory plus swap. Must be used with the **-m** +(**--memory**) flag. The swap `LIMIT` should always be larger than **-m** +(**--memory**) value. + + The format of `LIMIT` is `[]`. Unit can be `b` (bytes), +`k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you don't specify a +unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap. **--shm-size**=*SHM-SIZE* Size of `/dev/shm`. The format is ``. `number` must be greater than `0`. diff --git a/man/docker-create.1.md b/man/docker-create.1.md index f35571a356..f0499e60f9 100644 --- a/man/docker-create.1.md +++ b/man/docker-create.1.md @@ -46,7 +46,7 @@ docker-create - Create a new container [**-m**|**--memory**[=*MEMORY*]] [**--mac-address**[=*MAC-ADDRESS*]] [**--memory-reservation**[=*MEMORY-RESERVATION*]] -[**--memory-swap**[=*MEMORY-SWAP*]] +[**--memory-swap**[=*LIMIT*]] [**--memory-swappiness**[=*MEMORY-SWAPPINESS*]] [**--name**[=*NAME*]] [**--net**[=*"bridge"*]] @@ -230,11 +230,14 @@ reservation. So you should always set the value below **--memory**, otherwise th hard limit will take precedence. By default, memory reservation will be the same as memory limit. -**--memory-swap**="" - Total memory limit (memory + swap) +**--memory-swap**="LIMIT" + A limit value equal to memory plus swap. Must be used with the **-m** +(**--memory**) flag. The swap `LIMIT` should always be larger than **-m** +(**--memory**) value. - Set `-1` to disable swap (format: [], where unit = b, k, m or g). -This value should always larger than **-m**, so you should always use this with **-m**. + The format of `LIMIT` is `[]`. Unit can be `b` (bytes), +`k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you don't specify a +unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap. **--memory-swappiness**="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. diff --git a/man/docker-run.1.md b/man/docker-run.1.md index e963d5277e..6d787295ec 100644 --- a/man/docker-run.1.md +++ b/man/docker-run.1.md @@ -47,7 +47,7 @@ docker-run - Run a command in a new container [**-m**|**--memory**[=*MEMORY*]] [**--mac-address**[=*MAC-ADDRESS*]] [**--memory-reservation**[=*MEMORY-RESERVATION*]] -[**--memory-swap**[=*MEMORY-SWAP*]] +[**--memory-swap**[=*LIMIT*]] [**--memory-swappiness**[=*MEMORY-SWAPPINESS*]] [**--name**[=*NAME*]] [**--net**[=*"bridge"*]] @@ -327,11 +327,14 @@ reservation. So you should always set the value below **--memory**, otherwise th hard limit will take precedence. By default, memory reservation will be the same as memory limit. -**--memory-swap**="" - Total memory limit (memory + swap) +**--memory-swap**="LIMIT" + A limit value equal to memory plus swap. Must be used with the **-m** +(**--memory**) flag. The swap `LIMIT` should always be larger than **-m** +(**--memory**) value. - Set `-1` to disable swap (format: [], where unit = b, k, m or g). -This value should always larger than **-m**, so you should always use this with **-m**. + The format of `LIMIT` is `[]`. Unit can be `b` (bytes), +`k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you don't specify a +unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap. **--mac-address**="" Container MAC address (e.g. 92:d0:c6:0a:29:33) diff --git a/runconfig/parse.go b/runconfig/parse.go index 3cf874ea99..c21d2a3e09 100644 --- a/runconfig/parse.go +++ b/runconfig/parse.go @@ -93,7 +93,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host flHostname = cmd.String([]string{"h", "-hostname"}, "", "Container host name") flMemoryString = cmd.String([]string{"m", "-memory"}, "", "Memory limit") flMemoryReservation = cmd.String([]string{"-memory-reservation"}, "", "Memory soft limit") - flMemorySwap = cmd.String([]string{"-memory-swap"}, "", "Total memory (memory + swap), '-1' to disable swap") + flMemorySwap = cmd.String([]string{"-memory-swap"}, "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") flKernelMemory = cmd.String([]string{"-kernel-memory"}, "", "Kernel memory limit") flUser = cmd.String([]string{"u", "-user"}, "", "Username or UID (format: [:])") flWorkingDir = cmd.String([]string{"w", "-workdir"}, "", "Working directory inside the container")