Attempting to use the builder image gcr.io/buildpacks/builder
with the Maven plugin spring-boot:build-image
goal or Gradle plugin bootBuildImage
task results in an error while pulling the run image gcr.io/buildpacks/gcp/run
specified in the builder image metadata.
Example Gradle output:
> Task :bootBuildImage
Building image 'docker.io/library/build-demo:0.0.1-SNAPSHOT'
> Pulling builder image 'gcr.io/buildpacks/builder:latest' ..................................................
> Pulled builder image 'gcr.io/buildpacks/builder@sha256:efb5f9b7cd976ab6e5a959f453795863a476878be8e5c20b50db22c8aec1227f'
> Pulling run image 'gcr.io/buildpacks/gcp/run' ..................................................
> Task :bootBuildImage FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootBuildImage'.
> Different digests IDs provided
Comment From: scottfrederick
pack
CLI can successfully pull the build and run images:
$ pack build docker.io/library/build-demo --builder gcr.io/buildpacks/builder --path build/libs/build-demo-0.0.1-SNAPSHOT.jar
latest: Pulling from buildpacks/builder
11ab3a0c1a8a: Pull complete
[ ... ]
10badd04bb4a: Pull complete
Digest: sha256:efb5f9b7cd976ab6e5a959f453795863a476878be8e5c20b50db22c8aec1227f
Status: Downloaded newer image for gcr.io/buildpacks/builder:latest
latest: Pulling from buildpacks/gcp/run
11ab3a0c1a8a: Already exists
[ ... ]
dadabbc219f0: Already exists
Digest: sha256:9b3973dd6765f88815318454e337b7f5aacf25cf27f3038be49ef18cf6fce3b1
Status: Downloaded newer image for gcr.io/buildpacks/gcp/run:latest
===> DETECTING
[detector] ERROR: No buildpack groups passed detection.
[detector] ERROR: Please check that you are running against the correct path.
[detector] ERROR: failed to detect: no buildpacks participating
ERROR: failed with status code: 6
This results in both images being pulled with the latest
tag:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gcr.io/buildpacks/builder latest 42da5db6a84f 2 hours ago 428MB
gcr.io/buildpacks/gcp/run latest ab8975f48640 3 hours ago 111MB
Spring Boot attempts to pull untagged images, which results in multiple run image downloads with different digests after the build failure:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gcr.io/buildpacks/builder latest 42da5db6a84f 3 hours ago 428MB
gcr.io/buildpacks/gcp/run 01a956fa9aad3612c9381cea556898bbcce446a0 ab8975f48640 3 hours ago 111MB
gcr.io/buildpacks/gcp/run 0416777a5a1e15b14db2b915536d59970d03a835 72d0dde704de 45 hours ago 111MB
Forcing the run image tag to latest
causes Boot to behave like pack
.
Comment From: scottfrederick
The docker pull
CLI command defaults the tag to latest
. The pack
CLI also defaults the tag via the go-containerregistry
library. Spring Boot should do the same.