When building an OCI image with Spring Boot buildpack support, the build can fail while pulling a Tanzu Java Buildpack image such as tanzu-java-buildpack/java-slim.
This can occur when using either of the following commands:
gradle bootBuildImage
mvn spring-boot:build-image
This issue can occur in cross-architecture environments, such as Apple Silicon systems, when the build requests the linux/amd64 platform explicitly and the failure may appear similar to the following:
Docker API call to '.../images/tanzu-build-docker-virtual.usw1.packages.broadcom.com/tanzu-java-buildpack/java-slim:latest/json?platform=%7B%22os%22%3A%22linux%22%2C%22architecture%22%3A%22amd64%22%7D' failed with status code 404 "Not Found" and message "image with reference tanzu-build-docker-virtual.usw1.packages.broadcom.com/tanzu-java-buildpack/java-slim:latest was found but its platform (linux) does not match the specified platform (linux/amd64)"
Tanzu Java Buildpack
Spring Boot Gradle plugin
Spring Boot Maven plugin
Docker-based image builds using Spring Boot buildpack support
Cross-architecture environments building for linux/amd64
Some Tanzu buildpack images did not include complete platform metadata.
Although the image reported the operating system as linux, the image metadata did not include the architecture value expected during the Docker platform check. As a result, when the build requested linux/amd64, Docker could not match the requested platform to the image metadata and the build failed.
The affected images are Tanzu Buildpack images hosted in the Broadcom Tanzu build registry. Broadcom documentation identifies tanzu-build.packages.broadcom.com as the registry used for Tanzu buildpacks and related build content.
Use an updated Tanzu Java Buildpack image that correctly reports the required platform metadata, then rerun the image build.
After the corrected image is in use, the Spring Boot image build should complete successfully.
If an older image tag is still in use, update to latest or to a newer fixed tag.
{
"Os": "linux",
"Architecture": "amd64"
}