Home > Blockchain >  Slow Docker build image - Sending context is very slow
Slow Docker build image - Sending context is very slow

Time:06-13

when I build a docker image from a docker-compose with "context" configured, it need a lot of time to complete. The step that keep too much time is "Sending context...": it need 20 minutes for a 85MB folder.

The issue appear both in Ubuntu 20.04 and MacOS (using colima as virualization engine).

The folder I need to send is a nodejs project, so it has a lot of small files in the node_modules folder, but I can not excclude it becouse I need to run the node project in the container.

Is there a way to speed up the Sending context step?

CodePudding user response:

I've found a solution: from docker-compose 1.25.1, docker support the BuildKit, a different way to build the image that solve this issue.

You only need to update the docker-compose and set this variable:

export DOCKER_BUILDKIT=1

https://docs.docker.com/develop/develop-images/build_enhancements/

  • Related