Expected behavior
If I execute Docker run with some CPU constraints, it seems like the Docker Daemon is ignoring these constraints completely. In my example, I created a container using the following command:
docker run -dti -v C:\Users\Administrator\share:C:\mnt --cpuset-cpus=“0-2” microsoft/windowsservercore powershell
The machine has 16 cores, there should only be used 3 of them. If the container requests 100% CPU, I would expect to see a usage of (3/16) = ~19% in both Docker stats and on the host system.
Actual behavior
In the Docker container, I started a program which produces heavy CPU load on all cores (calculating some prime numbers). Instead of seeing around 20%, it is allowed to use the whole CPU usage! So the CPU usage of the host system goes up to 100% (exactly what I want to prevent).
If I get information about the processor using
Get-WmiObject -class Win32_processor | ft systemname,Name,DeviceID,NumberOfCores,NumberOfLogicalProcessors, Addresswidth
it also repsonds with all the processors available on the system.
Is it not possible to use these CPU constraints on Docker for Windows? I also experimented with the other constraints described here https://docs.docker.com/engine/reference/run/#/runtime-constraints-on-resources. Nothing really worked.
Information
Host system:
- Windows Server 2016
- 2 Intel Xeon E7520
Client:
Version: 1.12.2-cs2-ws-beta
API version: 1.25
Go version: go1.7.1
Git commit: 050b611
Built: Tue Oct 11 02:35:40 2016
OS/Arch: windows/amd64
Server:
Version: 1.12.2-cs2-ws-beta
API version: 1.25
Go version: go1.7.1
Git commit: 050b611
Built: Tue Oct 11 02:35:40 2016
OS/Arch: windows/amd64
Steps to reproduce the behavior
- setup Docker for Windows on Windows Server 2016
- docker run -dti -v C:\Users\Administrator\share:C:\mnt --cpuset-cpus=“0-2” microsoft/windowsservercore powershell
- execute something which produces heavy CPU load ( I simply used this C program with OpenMP http://stackoverflow.com/questions/9244481/how-to-get-100-cpu-usage-from-a-c-program )