How many cores are available in the build environment

docker

#1

How many cores are available in the build environment? Do they change based on the docker image? thanks.


#2

If you want to know anything about the container that runs your build, the best solution is to SSH into it:

ubuntu@box1268:~$ cat /proc/cpuinfo | grep processor | wc -l
32
ubuntu@box1268:~$ cat /proc/cpuinfo | grep 'core id'
core id        : 0
core id        : 1
core id        : 2
core id        : 3
core id        : 4
core id        : 5
core id        : 6
core id        : 7
core id        : 0
core id        : 1
core id        : 2
core id        : 3
core id        : 4
core id        : 5
core id        : 6
core id        : 7
core id        : 0
core id        : 1
core id        : 2
core id        : 3
core id        : 4
core id        : 5
core id        : 6
core id        : 7
core id        : 0
core id        : 1
core id        : 2
core id        : 3
core id        : 4
core id        : 5
core id        : 6
core id        : 7
--------------
	ubuntu@box1268:~$ nproc
2
--------------
	ubuntu@box1268:~$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                32
On-line CPU(s) list:   0-31
Thread(s) per core:    2
Core(s) per socket:    8
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 62
Stepping:              4
CPU MHz:               2800.106
BogoMIPS:              5673.87
Hypervisor vendor:     Xen
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              25600K
NUMA node0 CPU(s):     0-7,16-23
NUMA node1 CPU(s):     8-15,24-31

#3

The Ubuntu image ships coreutils i.e. you can simply use nproc.


#4

When you scroll down in my log above, you can see the output of nproc.


#5