Running command in docker container is 5x slower

Viewed 20

When running this command, I get a total build time of (on average) 70s.

docker run -v $(pwd)/app:/srv -w /srv --rm -it node:16 npm run build

When running the command directly, locally (npm run build) it takes on average 14s.

Is there a reason the command takes so much longer to run in a docker container?

System details:
macOS 12.5
docker version 20.10.17, build 100c701
Resources given to docker: 
CPUs - 8
Memory - 8gb
Swap - 2gb
0 Answers
Related