5.15 Limiting CPU Usage by Containers

To control a container's CPU usage, you can use the --cpu-period and --cpu-quota options with the docker create and docker run commands.

The --cpu-quota option specifies the number of microseconds that a container has access to CPU resources during a period specified by --cpu-period. As the default value of --cpu-period is 100000, setting the value of --cpu-quota to 25000 limits a container to 25% of the CPU resources. By default, a container can use all available CPU resources, which corresponds to a --cpu-quota value of -1.