本文共 1072 字,大约阅读时间需要 3 分钟。
[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-perioddocker 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掉 ![](https://s1.51cto.com/images/blog/201801/07/e30678d2a5c491319722f49410ae7e49.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
转载于:https://blog.51cto.com/wsxxsl/2058273