nvcnvn
nvcnvn

Reputation: 5175

How to check why a docker build slow?

I'm building my go program via:

RUN go install .

If I run the same command go install . on my host machine (with all cache pruned) I can see my CPU working hard (> 50% all cores). The same command run via Docker in contrast seem not use that much CPU and result is really slow build time.

Is their any way I can check resource usages for docker build command, something like docker stats?

Upvotes: 1

Views: 1391

Answers (1)

Attila Viniczai
Attila Viniczai

Reputation: 693

If you have a sufficiently new Docker available, try using Docker BuildKit:

DOCKER_BUILDKIT=1 docker build ...

I experienced a significant increase in build speed after switching to BuildKit.

Upvotes: 2

Related Questions