-
Notifications
You must be signed in to change notification settings - Fork 194
Fix #858: tell buildx which platform to build for #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This should explicitly instruct buildx to export the finished build as a standard image in the local Docker daemon.
Turns out it's not valid.
It gets hard to know what is happening when everthing is called "qsim".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/devops
Involves build systems, Make files, Bazel files, continuous integration, and/or other DevOps topics
size: S
10< lines changed <50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Docker builds on GitHub are failing with the problem that Docker build is trying to get qsim images from docker.io:
Apparently, this happens because the
buildxplugin, 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 (likeqsim): might not be immediately loaded into the local Docker daemon's image store. When the build for a dependent service (likeqsim-cxx-tests) starts, it can't find theqsimbase image locally and falls back to searching Docker Hub.This is despite the fact that a plain
docker compose buildlocally (at least in my Debian Linux environment) works as expected.After a lot of trial and error, the only solution I could find is to split up the
docker compose build …into 2 steps, the first being to build the qsim base image separately:In addition to this change, in the process of debugging this I found it useful to make some housekeeping changes to the
Dockerfileanddocker-compose.ymlfiles, in particular to change the names of jobs and images to distinguish the different things being run or built. (Having several things all namedqsimwas not helpful.)Noting here what else I tried and that didn't work:
What I thought would be the obvious solution (i.e., using the command-line argument
--parallel 1or setting the env varCOMPOSE_PARALLEL_LIMITto tellbuildxnot to build in parallel) did not work on GitHub. Since I can't reproduce the problem locally, I can't be sure if that would have solved it anyway.Trying to use the buildx
bakecommand first, like this:Trying to clear the Docker cache.