Restrict the use of container resources

Memory Limit

docker run -it -m 200M --memory-swap=300M images:version --vm 1 --vm-bytes 280M

-m: memory limit                                             

--memeory-swap: + swap memory usage limit (default -m 2 times)

--vm: Start a worker thread memory

--vm-bytes: each thread of memory

 

cpu weight

-c: set cpu weights, the default is 1024

--cpu: Set the number of worker threads

 

block IO weights

--blkio-weight: block IO priority, default is 500

 

 

 

bps (number per second read and write), and cps (IO per second)

--device-read-bps: restrict reading of a device bps

--device-write-bps: restrict write a device bps

--device-read-iops: reading a device to limit the iops

--device-write-iops: restrict write a device iops

docker run -it --device-write-bps /dev/sda:30MB centos

test:

time dd if=/dev/zero of=test.out bs=1M count=800 oflag=direct

 

Guess you like

Origin www.cnblogs.com/ray-mmss/p/11057794.html