mirror of
https://github.com/docker/cli.git
synced 2026-09-24 23:41:10 -05:00
add cpu.cfs_period_us support
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com> Upstream-commit: dccb8b5c339e218222bae4ce74bbeccb9e020c82 Component: engine
This commit is contained in:
@@ -13,6 +13,7 @@ docker-create - Create a new container
|
||||
[**--cap-add**[=*[]*]]
|
||||
[**--cap-drop**[=*[]*]]
|
||||
[**--cidfile**[=*CIDFILE*]]
|
||||
[**--cpu-period**[=*0*]]
|
||||
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
||||
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
||||
[**--cpu-quota**[=*0*]]
|
||||
@@ -78,6 +79,9 @@ IMAGE [COMMAND] [ARG...]
|
||||
**--cgroup-parent**=""
|
||||
Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.
|
||||
|
||||
**--cpu-peroid**=0
|
||||
Limit the CPU CFS (Completely Fair Scheduler) period
|
||||
|
||||
**--cpuset-cpus**=""
|
||||
CPUs in which to allow execution (0-3, 0,1)
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ docker-run - Run a command in a new container
|
||||
[**--cap-add**[=*[]*]]
|
||||
[**--cap-drop**[=*[]*]]
|
||||
[**--cidfile**[=*CIDFILE*]]
|
||||
[**--cpu-period**[=*0*]]
|
||||
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
||||
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
||||
[**-d**|**--detach**[=*false*]]
|
||||
@@ -138,6 +139,11 @@ division of CPU shares:
|
||||
**--cidfile**=""
|
||||
Write the container ID to the file
|
||||
|
||||
**--cpu-period**=0
|
||||
Limit the CPU CFS (Completely Fair Scheduler) period
|
||||
|
||||
Limit the container's CPU usage. This flag tell the kernel to restrict the container's CPU usage to the period you specify.
|
||||
|
||||
**--cpuset-cpus**=""
|
||||
CPUs in which to allow execution (0-3, 0,1)
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@ Create a container
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 512,
|
||||
"CpuPeriod": 100000,
|
||||
"CpusetCpus": "0,1",
|
||||
"CpusetMems": "0,1",
|
||||
"BlkioWeight": 300,
|
||||
@@ -193,6 +194,7 @@ Json Parameters:
|
||||
always use this with `memory`, and make the value larger than `memory`.
|
||||
- **CpuShares** - An integer value containing the CPU Shares for container
|
||||
(ie. the relative weight vs other containers).
|
||||
- **CpuPeriod** - The length of a CPU period (in microseconds).
|
||||
- **Cpuset** - The same as CpusetCpus, but deprecated, please don't use.
|
||||
- **CpusetCpus** - String value containing the cgroups CpusetCpus to use.
|
||||
- **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
|
||||
@@ -350,6 +352,7 @@ Return low-level information on the container `id`
|
||||
"CpusetCpus": "",
|
||||
"CpusetMems": "",
|
||||
"CpuShares": 0,
|
||||
"CpuPeriod": 100000,
|
||||
"Devices": [],
|
||||
"Dns": null,
|
||||
"DnsSearch": null,
|
||||
|
||||
@@ -950,6 +950,7 @@ Creates a new container.
|
||||
--cidfile="" Write the container ID to the file
|
||||
--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)
|
||||
--cpu-period=0 Limit the CPU CFS (Completely Fair Scheduler) period
|
||||
--cpu-quota=0 Limit the CPU CFS (Completely Fair Scheduler) quota
|
||||
--device=[] Add a host device to the container
|
||||
--dns=[] Set custom DNS servers
|
||||
@@ -1907,6 +1908,7 @@ To remove an image using its digest:
|
||||
--cidfile="" Write the container ID to the file
|
||||
--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)
|
||||
--cpu-period=0 Limit the CPU CFS (Completely Fair Scheduler) period
|
||||
--cpu-quota=0 Limit the CPU CFS (Completely Fair Scheduler) quota
|
||||
-d, --detach=false Run container in background and print container ID
|
||||
--device=[] Add a host device to the container
|
||||
|
||||
@@ -483,6 +483,7 @@ container:
|
||||
-m, --memory="": Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||
-memory-swap="": Total memory limit (memory + swap, format: <number><optional unit>, where unit = b, k, m or g)
|
||||
-c, --cpu-shares=0: CPU shares (relative weight)
|
||||
--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.
|
||||
--cpu-quota=0: Limit the CPU CFS (Completely Fair Scheduler) quota
|
||||
@@ -620,6 +621,20 @@ division of CPU shares:
|
||||
101 {C1} 1 100% of CPU1
|
||||
102 {C1} 2 100% of CPU2
|
||||
|
||||
### CPU period constraint
|
||||
|
||||
The default CPU CFS (Completely Fair Scheduler) period is 100ms. We can use
|
||||
`--cpu-period` to set the period of CPUs to limit the container's CPU usage.
|
||||
And usually `--cpu-period` should work with `--cpu-quota`.
|
||||
|
||||
Examples:
|
||||
|
||||
$ docker run -ti --cpu-period=50000 --cpu-quota=25000 ubuntu:14.04 /bin/bash
|
||||
|
||||
If there is 1 CPU, this means the container can get 50% CPU worth of run-time every 50ms.
|
||||
|
||||
For more information, see the [CFS documentation on bandwidth limiting](https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt).
|
||||
|
||||
### Cpuset constraint
|
||||
|
||||
We can set cpus in which to allow execution for containers.
|
||||
|
||||
Reference in New Issue
Block a user