Skip to content

Conversation

@hojooo
Copy link

@hojooo hojooo commented Sep 21, 2025

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:

  • During buildpack layer export, platform information wasn't passed to the docker save command
  • Multi-architecture image inspection didn't properly respect the pulled digest, leading to platform conflicts

Changes Made

1. Respect pulled digest when inspecting multi-arch images

  • File: buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java
  • Change: Modified image inspection logic to use the actual pulled digest instead of the manifest tag
  • Impact: Prevents platform mismatch errors when working with multi-architecture images

2. Respect image platform when exporting buildpack layers

  • File: buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java
  • Change: Enhanced Docker save operations to include platform information
  • Impact: Ensures correct platform handling during buildpack layer export

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 <ghwn5833@gmail.com>
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 <ghwn5833@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 21, 2025
@hojooo
Copy link
Author

hojooo commented Oct 27, 2025

#46674 (comment)

Signed-off-by: hojooo <ghwn5833@gmail.com>
@hojooo hojooo force-pushed the fix-build-docker-image branch from 66ac80d to 174fdb3 Compare October 28, 2025 07:36
Signed-off-by: hojooo <ghwn5833@gmail.com>
Signed-off-by: hojooo <ghwn5833@gmail.com>
@hojooo hojooo force-pushed the fix-build-docker-image branch 3 times, most recently from 2a15da3 to 8d5a456 Compare November 4, 2025 13:33
Signed-off-by: hojooo <ghwn5833@gmail.com>
@hojooo hojooo force-pushed the fix-build-docker-image branch from 8d5a456 to 772add5 Compare November 4, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants