--cpu-shares
Set this flag to a value greater or less than the default of 1024 to increase or reduce the container’s weight, and give it access to a greater or lesser proportion of the host machine’s CPU cycles. This is only enforced when CPU cycles are constrained. When plenty of CPU cycles are available, all containers use as much CPU as they need. In that way, this is a soft limit. --cpu-sharesdoes not prevent containers from being scheduled in swarm mode. It prioritizes container CPU resources for the available CPU cycles. It does not guarantee or reserve any specific CPU access.
$ docker run -ti --cpu-period=100000 --cpu-quota=200000
--cpu-set-cpus
给容器实际4核的CPU
$ docker run -ti --cpuset-cpus=4 busybox
阻塞IO
有两个选项可用于调整给定容器对直接块IO设备的访问。
您还可以按照每秒的字节数或每秒的IO操作来指定带宽限制。
OptionDescription
blkio-weight
By default, each container can use the same proportion of block IO bandwidth (blkio). The default weight is 500. To raise or lower the proportion of blkio used by a given container, set the --blkio-weight flag to a value between 10 and 1000. This setting affects all block IO devices equally.
blkio-weight-device
The same as --blkio-weight, but you can set a weight per device, using the syntax --blkio-weight-device="DEVICE_NAME:WEIGHT" The DEVICE_NAME:WEIGHT is a string containing a colon-separated device name and weight.
--device-read-bps and--device-write-bps
Limits the read or write rate to or from a device by size, using a suffix of kb, mb, or gb.
--device-read-iops or--device-write-iops
Limits the read or write rate to or from a device by IO operations per second.