diff --git a/docs/reference/commandline/create.md b/docs/reference/commandline/create.md index 5e3c04efa5..23c8797686 100644 --- a/docs/reference/commandline/create.md +++ b/docs/reference/commandline/create.md @@ -35,6 +35,7 @@ Options: --cpu-period int Limit CPU CFS (Completely Fair Scheduler) period --cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota -c, --cpu-shares int CPU shares (relative weight) + --cpus NanoCPUs Number of CPUs (default 0.000) --cpu-rt-period int Limit the CPU real-time period in microseconds --cpu-rt-runtime int Limit the CPU real-time runtime in microseconds --cpuset-cpus string CPUs in which to allow execution (0-3, 0,1) diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index 0c4a2688d8..82745a2efe 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -33,6 +33,7 @@ Options: --cpu-period int Limit CPU CFS (Completely Fair Scheduler) period --cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota -c, --cpu-shares int CPU shares (relative weight) + --cpus NanoCPUs Number of CPUs (default 0.000) --cpu-rt-period int Limit the CPU real-time period in microseconds --cpu-rt-runtime int Limit the CPU real-time runtime in microseconds --cpuset-cpus string CPUs in which to allow execution (0-3, 0,1) diff --git a/docs/reference/run.md b/docs/reference/run.md index f513f82ca0..9bb6cfc11e 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -686,6 +686,7 @@ container: | `--memory-reservation=""` | Memory soft limit (format: `[]`). Number is a positive integer. Unit can be one of `b`, `k`, `m`, or `g`. | | `--kernel-memory=""` | Kernel memory limit (format: `[]`). Number is a positive integer. Unit can be one of `b`, `k`, `m`, or `g`. Minimum is 4M. | | `-c`, `--cpu-shares=0` | CPU shares (relative weight) | +| `--cpus=0.000` | Number of CPUs. Number is a fractional number. 0.000 means no limit. | | `--cpu-period=0` | Limit the CPU CFS (Completely Fair Scheduler) period | | `--cpuset-cpus=""` | CPUs in which to allow execution (0-3, 0,1) | | `--cpuset-mems=""` | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. | @@ -970,6 +971,13 @@ Examples: If there is 1 CPU, this means the container can get 50% CPU worth of run-time every 50ms. +In addition to use `--cpu-period` and `--cpu-quota` for setting CPU period constraints, +it is possible to specify `--cpus` with a float number to achieve the same purpose. +For example, if there is 1 CPU, then `--cpus=0.5` will achieve the same result as +setting `--cpu-period=50000` and `--cpu-quota=25000` (50% CPU). + +The default value for `--cpus` is `0.000`, which means there is no limit. + For more information, see the [CFS documentation on bandwidth limiting](https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt). ### Cpuset constraint diff --git a/man/docker-create.1.md b/man/docker-create.1.md index fd19ee45c6..ff378397ed 100644 --- a/man/docker-create.1.md +++ b/man/docker-create.1.md @@ -19,6 +19,7 @@ docker-create - Create a new container [**--cpu-quota**[=*0*]] [**--cpu-rt-period**[=*0*]] [**--cpu-rt-runtime**[=*0*]] +[**--cpus**[=*0.0*]] [**--cpuset-cpus**[=*CPUSET-CPUS*]] [**--cpuset-mems**[=*CPUSET-MEMS*]] [**--device**[=*[]*]] @@ -154,6 +155,9 @@ two memory nodes. The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup. +**--cpus**=0.0 + Number of CPUs. The default is *0.0*. + **--device**=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm) diff --git a/man/docker-run.1.md b/man/docker-run.1.md index d430ff58a5..5af64627be 100644 --- a/man/docker-run.1.md +++ b/man/docker-run.1.md @@ -19,6 +19,7 @@ docker-run - Run a command in a new container [**--cpu-quota**[=*0*]] [**--cpu-rt-period**[=*0*]] [**--cpu-rt-runtime**[=*0*]] +[**--cpus**[=*0.0*]] [**--cpuset-cpus**[=*CPUSET-CPUS*]] [**--cpuset-mems**[=*CPUSET-MEMS*]] [**-d**|**--detach**] @@ -208,6 +209,9 @@ to the quota you specify. The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup. +**--cpus**=0.0 + Number of CPUs. The default is *0.0* which means no limit. + **-d**, **--detach**=*true*|*false* Detached mode: run the container in the background and print the new container ID. The default is *false*.