0

I have a quite simple Spring Boot app building Docker images for Azure. Probably Azure is not relevant to the problem. The image is built using the Spring Boot Gradle plugin, using the bootBuildImage task.

Now, suddenly, with otherwise unchanged code, the build started to fail:

> Task :backend:bootBuildImage FAILED
…
… Invalid response received when loading image "pack.local/builder/uxjmhhddud:latest"

The name of the image changes with each run, looks like a temporary intermediate image that cannot be read.

What causes this failure and what can be done about it?


Edit: More log context:

> Task :backend:bootBuildImage
Building image 'docker.io/library/backend:latest'

 > Pulling builder image 'docker.io/paketobuildpacks/builder@sha256:edb18b93f138def92ada50bebdffa05983b13a5f5c4df6af75a40f2275d092ed' ..................................................
 > Pulled builder image 'paketobuildpacks/builder@sha256:edb18b93f138def92ada50bebdffa05983b13a5f5c4df6af75a40f2275d092ed'
 > Pulling run image 'docker.io/paketobuildpacks/run@sha256:c6a219b27b2009cf99d92bc4a667ceb81822074406809d6c87e3dce906349546' ..................................................
 > Pulled run image 'paketobuildpacks/run@sha256:c6a219b27b2009cf99d92bc4a667ceb81822074406809d6c87e3dce906349546'
 > Pulling buildpack image 'gcr.io/paketo-buildpacks/java-azure:latest' ..................................................
 > Pulled buildpack image 'gcr.io/paketo-buildpacks/java-azure@sha256:704f74c1cc11cbe8cc5702a63cd77aa4c476d9051f022aabb7188bdc5e3fd2fc'

> Task :backend:bootBuildImage FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':backend:bootBuildImage'.
> Invalid response received when loading image "pack.local/builder/xojqjhijta:latest"
Michael Piefel
  • 18,660
  • 9
  • 81
  • 112
  • Can you post the full build output? If there's something wrong with a particular builder, I can make sure it gets addressed but I need to know more details. Thanks – Daniel Mikusa Aug 02 '22 at 17:26
  • Problematic output pasted. While trying to minimize the log, I found one interesting piece of information: When the Azure build pack is included with `buildpacks = listOf("gcr.io/paketo-buildpacks/java-azure")`, then the build fails, when I comment it out, the build will succeed! – Michael Piefel Aug 23 '22 at 08:58

1 Answers1

0

After ruling out Docker daemon problems or proxies and so on, I decided that perhaps the version of the Paketo builder is just buggy. And indeed, pinning the version to the last known good worked:

tasks.bootBuildImage {
    // Pin version to known working
    builder = "paketobuildpacks/builder@sha256:855aaa00a7eadca9c6cdba72550889f7c618c2bf1489c29fb9e7e01588665db7"
    …
}

Newer runner and base images worked fine.

Michael Piefel
  • 18,660
  • 9
  • 81
  • 112
  • Glad this worked, don't forget to unpin it later or you'll be stuck on an older builder and won't get updates. It can also sometimes be helpful to delete the volumes that are used to store cached information from one build to the next. If you `docker volume ls`, you can see the volumes & you can use `docker volume rm` to delete them. Spring Boot also has a cache clear flag, you can set which should do the same. – Daniel Mikusa Aug 02 '22 at 17:28
  • Concerning pinning: In a way, it is even _better_ to use pinned versions, because this ensures reproducible builds. However, there is no tooling that will inform me of new versions (that I know of). – Michael Piefel Aug 23 '22 at 09:01
  • Be careful using a term like "better", that's subjective. There are trade-offs with both approaches. If you are going to pin versions, I would suggest having a CI job or something that periodically runs against the latest builder/buildpacks and validates. That will help you validate new versions against your app. – Daniel Mikusa Aug 25 '22 at 12:30