Skip to content

Commit 9bdf01d

Browse files
committed
Fix #858: tell buildx which platform to build for
Docker builds on GitHub are failing with the problem that Docker build is trying to get qsim images from docker.io: ``` #1 [internal] load local bake definitions #1 reading from stdin 935B done #1 DONE 0.0s #2 [qsim internal] load build definition from Dockerfile #2 transferring dockerfile: 1.34kB done #2 DONE 0.0s #3 [qsim-py-tests internal] load build definition from Dockerfile #3 transferring dockerfile: 381B done #3 DONE 0.0s #4 [qsim-cxx-tests internal] load build definition from Dockerfile #4 transferring dockerfile: 208B done #4 DONE 0.0s #5 [qsim-cxx-tests internal] load metadata for #docker.io/library/qsim:latest ``` Apparently, this happens because the `buildx` plugin, which is the default builder in many modern Docker setups, can build images in parallel and uses an isolated builder environment. An image built for one service (like `qsim`): might not be immediately loaded into the local Docker daemon's image store. When the build for a dependent service (like `qsim-cxx-tests`) starts, it can't find the `qsim` base image locally and falls back to searching Docker Hub. While `depends_on` controls the runtime start order of containers, the build-time dependency inference can be tricky in this parallel execution environment. One way to fix this is to explicitly tell `buildx` which platform to build for. This forces buildx to build a single-platform image and load its layers into the local image store, making it available to subsequent build steps.
1 parent 7932f78 commit 9bdf01d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
services:
22
qsim:
3+
platform: linux/amd64
34
image: qsim
45
container_name: qsim
56
build:
67
context: ./
78
dockerfile: Dockerfile
89
qsim-cxx-tests:
10+
platform: linux/amd64
911
image: qsim-cxx-tests
1012
container_name: qsim-cxx-tests
1113
build:
@@ -14,6 +16,7 @@ services:
1416
depends_on:
1517
- qsim
1618
qsim-py-tests:
19+
platform: linux/amd64
1720
image: qsim-py-tests
1821
container_name: qsim-py-tests
1922
build:

0 commit comments

Comments
 (0)