[root@localhost ~]# docker run --help |grep cpu
--cpu-percent int CPU percent (Windows only)
--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)
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
--cpu-period
docker run -d -e "container=docker" --net=none --privileged=true -m 1024M --cpu-period=100000 --cpu-quota=200000 -v /sys/fs/cgroup:/sys/fs/cgroup -v /home/data/logs:/home/data/logs -v /opt:/opt --name centos7.1 centos /usr/sbin/init
[root@e0dfb35f1989 /]# dd if=/dev/zero of=/dev/null
--cpu-period=100000
--cpu-quota=200000 占用几个CPU
Docker的内存限制的是如果给1G docker容器最多能用2G ,跑满2G 容器就会被kill掉 如果给2G docker容器最多能用4G 跑满4G就会被kill掉