fix: Add --load flag to buildx build command#2514
Conversation
There was a problem hiding this comment.
Pull request overview
Adds --load to the docker buildx build invocation so locally-built images are exported from the BuildKit cache into the Docker daemon, preventing “pull access denied” failures when starting containers from freshly-built images.
Changes:
- Add
--loadto the defaultBuildImagebuildx command. - Add a changeset entry documenting the behavior change.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
framework/docker.go |
Ensures buildx-built images are loaded into the local Docker daemon by adding --load. |
framework/.changeset/v0.15.15.md |
Documents the change in image build behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if os.Getenv("GITHUB_TOKEN") != "" { | ||
| commandParts = append(commandParts, "--secret", "id=GIT_AUTH_TOKEN,env=GITHUB_TOKEN") | ||
| } | ||
| commandParts = append(commandParts, "-t", nameAndTag, "-f", dfilePath, dctx) | ||
| commandParts = append(commandParts, "--load", "-t", nameAndTag, "-f", dfilePath, dctx) | ||
| return RunCommand(commandParts[0], commandParts[1:]...) |
There was a problem hiding this comment.
--load is only added in the non-CTF_CLNODE_DLV branch. The CTF_CLNODE_DLV=true path still runs docker buildx build without --load, so it can still produce images that remain only in the BuildKit cache (and fail to start via Docker daemon). Consider adding --load to the DLV branch as well so both code paths behave consistently.
--secretfor private plugin auth--loadensures the image is exported from BuildKit cache into the Docker daemon regardless of which buildx driver is active