Docker container has low CPU utilization

Hi everyone,

I am currently working on a project that involves compiling the Arch Kernel in a Docker container. However the whole procedure takes very long. Compiling the Kernel is totally multithreadable and doing so on my machine directly uses 100% CPU. However when I start the process in a docker container it is slow as hell only using about 20% of one core of my host. I though Docker utilized as much of the host resources as it can. How can I speed up the process?

Thanks in advance!

Check how much resources are allocated to the container or docker in general, if there’s a limit, make it bigger. That should solve it.

Possibly useful link: https://docs.docker.com/config/containers/resource_constraints/

1 Like

Thanks for your help. When I read this page it actually made ‘click’ in my head. The problem was not that Docker did restrict the usage of resources since I never applied any limits, but that the make script uses something like $(nproc) to find out how many threads your CPU supports. This however failed in Docker and defaulted to 1 thread. When I set the according flag for the script as a environment variable before running the build it fully utilized the CPU.