Of the many ways to limit CPU resources per container, one of the easiest is to specify the −cpus flag when starting the container. The flag communicates the CPU resource configuration to the Completely Fair Scheduler (CFS), which is the Linux kernel CPU scheduler for normal Linux processes. The −cpus flag specifies the maximum available CPU resources that the container can use. In the following example, −cpus=“2” limits the container to a maximum of two cores on the server:
$ docker run –cpus=“2” --name sqlservername -e “ACCEPT_EULA” -e “MSSQL_SA_PASSWORD=password” -v volumename:/var/opt/mssql-data-dir -p 1433:1433 -d localhost:5000/sql2019
For processor-intensive applications such as databases, CPU settings assist with managing SLAs and enable greater consolidation.