I have a Docker container built on the ubuntu:latest base image that contains some python scripts. One of them does OCR on text and I've noticed the script it ~2-3x slower when I run it from docker compared to running it on local. Looking at resource usage when the script it running, it looks like it can detect 12 cores available for use but the container is only using one container at 100 % and the rest remain idle. When running it locally, it looks like all cores are working.
I also tried to run it with concurrent.futures.ThreadPoolExecutor, but the container will always cap at 100 % and not use more than 1 CPU core.
I've found a lot of information about how to limit resources, but there is nothing that would force usage of resources. I also have tried an image based on the python:3.10 image, but the same slowness and issue persists. That image is built on debian bullseye.
Per recommendation ran lscpu inside the container and got the following:
root@22b8b40396d5:/code# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 12
On-line CPU(s) list: 0-11
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
CPU family: 6
Model: 158
Thread(s) per core: 2
Core(s) per socket: 6
Socket(s): 1
Stepping: 10
BogoMIPS: 7391.99
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb r
dtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 mo
vbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow
vnmi ept vpid ept_ad fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 x
saves flush_l1d arch_capabilities
