Here is a video version of question: (so you can see error live)
https://www.dropbox.com/s/35beu44guclysk1/docker_issue.mov?dl=0
Here is a text version of question
I have the following script that I am running on mac os 13.1 on mac book pro m1 max (Docker version 20.10.21). The version of docker on the server that I am building it on is Docker version 20.10.22 (using --context
)
ttab build_and_deploy_web_1.sh
ttab build_and_deploy_web_2.sh
ttab build_and_deploy_web_3.sh
ttab build_and_deploy_web_4.sh
ttab build_and_deploy_web_1_backup.sh
ttab build_and_deploy_web_2_backup.sh
Inside each of these scripts is this (only difference in each would be context and some servers might have an extra container.
DOCKER_BUILDKIT=1 docker --context php-pos-web-2 build --platform=linux/amd64 -t common/postfix ../common/postfix
docker --context php-pos-web-2 compose build
docker --context php-pos-web-2 compose up -d
Randomly during the build process, one or more of the tabs will fail with this error message:
[+] Building 8.0s (2/2) FINISHED
=> ERROR [internal] load build definition from Dockerfile 5.0s
=> CANCELED [internal] load .dockerignore 5.0s
------
> [internal] load build definition from Dockerfile:
------
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: no active session for skr0tc1lbhw715v7barh4o73e: context deadline exceeded
If I run each of these scripts sequentially I don’t get the error.
What does this error mean and is there anyway I solve this?
I know I could use docker swarm for something like this, but I don’t want to maintain a registry and this solution is almost perfect if the tabs didn’t fail.
2
Answers
I’ve got previously different issues running multiple docker build processes simultaneously. Eventually I decided to use kaniko which does an image build isolated in container.
I had the same issue and the reason is docker buildkit parallelization feature that cannot effectively manage I/O bound build in parallel.
I had mutiple frontend projects that are fetching lot of small files with the
npm install
command.I have solved with an hack: single Dockerfile, multistage build for a docker compose, and a file that act as a dependency between projects to run sequentially frontend stages.