Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CPU resources during docker build command on Windows

How can one control how many logical processors are used by docker build command on Windows?

I have this dockerfile:

FROM mcr.microsoft.com/windows/servercore:1803
SHELL ["powershell", "-NoLogo"]
RUN Get-ComputerInfo -Property *proc*
CMD Get-ComputerInfo -Property *proc*

and when I build an image I see the following output:

CsNumberOfLogicalProcessors : 2
CsNumberOfProcessors        : 1

Note that my computer has 4 logical processors and when I run container with --cpus 4 option I get an expected result:

CsNumberOfLogicalProcessors : 4
CsNumberOfProcessors        : 1

What confuses me is why docker build does not support --cpus option since it runs containers when creating image layers.

Docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 41
Server Version: 18.09.0
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: ics l2bridge l2tunnel nat null overlay transparent
 Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 17763 (17763.1.amd64fre.rs5_release.180914-1434)
Operating System: Windows 10 Pro Version 1809 (OS Build 17763.194)
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 7.891GiB
Name: Robo
ID: K3BP:UY7Z:JEXA:EJZ6:IYK6:WMW4:L4P4:5GTY:VR7K:SQKR:5QMO:AIEA
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 28
 System Time: 2018-12-16T16:48:59.7060639Z
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
like image 770
Pavels Ahmadulins Avatar asked May 12 '26 22:05

Pavels Ahmadulins


1 Answers

Not supported currently. You can track issue here https://github.com/moby/moby/issues/38387

like image 91
Gregory Suvalian Avatar answered May 14 '26 12:05

Gregory Suvalian