-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Image building may fail when specifying a platform if an image has already been built with a different platform #47292
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
+152
−11
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
Ensure the builder propagates the requested image platform to DockerApi.exportLayers so Docker 1.41+ saves layers for the pulled architecture rather than the host default. Add platform-aware tests issue: spring-projects#46665 Signed-off-by: hojooo <[email protected]>
Capture the digest emitted during the pull stream and inspect name@digest so the newly pulled manifest is always used. issue: spring-projects#46674. Signed-off-by: hojooo <[email protected]>
mkhaled2
reviewed
Oct 2, 2025
...latform/src/test/java/org/springframework/boot/buildpack/platform/docker/DockerApiTests.java
Outdated
Show resolved
Hide resolved
Contributor
Author
Signed-off-by: hojooo <[email protected]>
66ac80d to
174fdb3
Compare
Signed-off-by: hojooo <[email protected]>
Signed-off-by: hojooo <[email protected]>
2a15da3 to
8d5a456
Compare
Signed-off-by: hojooo <[email protected]>
8d5a456 to
772add5
Compare
Signed-off-by: hojooo <[email protected]>
Signed-off-by: hojooo <[email protected]>
2d2e41b to
fc86c38
Compare
Signed-off-by: hojooo <[email protected]>
philwebb
pushed a commit
that referenced
this pull request
Nov 12, 2025
Prior to this commit, performing a build on a ARM Mac with the default configuration and then building it again with the image platform set to `linux/amd64` results in an "Image platform mismatch detected" failure. This is due to the fact that `docker inspect` returns JSON for the default platform, regardless of the fact that another architecture has been pulled. To solve the issue, the `inspect` API call on Docker 1.49+ can now accept a platform query parameter which when specified returns platform specific JSON. At the time of this commit, the Docker API documentation hasn't been updated, despite PR moby/moby#49586 being merged. In addition to using the correct inspect JSON, we also need to pin the run image we use to a specific digest. Without doing this, buildpacks revert back to the default platform image and "content digest not found" errors are thrown (similar to https://github.com/buildpacks/docs/issues/818). See gh-47292 Signed-off-by: hojooo <[email protected]>
philwebb
added a commit
that referenced
this pull request
Nov 12, 2025
Member
|
Thanks very much @hojooo, this must have been quite some effort to work out how to fix (especially as the Docker API docs are incomplete). I've merged it into 3.4.x with a few changes, the main one being to remove the platform when doing the export. I think we can get away without that. |
Contributor
Author
|
Thanks, @philwebb ! Related issue: #46665 (comment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fixes Docker platform handling issues that occur when building images for a platform different from the host platform. The changes ensure that platform information is properly propagated throughout the buildpack layer export and multi-architecture image inspection processes.
Related Issues
Root Cause
The issues stemmed from incomplete platform information propagation in the Docker API implementation:
Changes Made
Inspect path improvements
Unified platform parameter encoding
Image.Descriptor parsing