8

I have updated my project to use springboot 2.3.0 and trying to build docker image using the default springboot gradle task bootBuildImage.

The project is a simple rest project broken into two parts:- interface definition and interface implementation. All this while I was using Dockerfile to build the image but I am trying to experiment with the new feature.

I have not changed any configuration nor I have added any customizations. I am just it as plain vanilla task but getting the below issue.

DAREYOURDREAM-96TZ:tm-provisioning dareyourdream$ gradle bootBuildImage --scan
Picked up _JAVA_OPTIONS: -Xms1024m -Xmx8192m -XX:MaxPermSize=1024m
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0

> Task :bootBuildImage
Building image 'docker.io/library/tm-provisioning:0.0.1-SNAPSHOT'

 > Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' ..................................................
 > Pulled builder image 'gcr.io/paketo-buildpacks/builder@sha256:200fb7945ef0f4a3c79befb1262fd592f54ba7b7ffcc8a37716434dd11d0e5e9'
 > Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' ..................................................
 > Pulled run image 'gcr.io/paketo-buildpacks/run@sha256:f7f27462fb513a70370322ada08440a642d24a700056d4c6b8cbb344610bf486'
 > Executing lifecycle version v0.7.5
 > Using build cache volume 'pack-cache-defc64ac2d6d.build'

 > Running creator
    [creator]     ---> DETECTING
    [creator]     5 of 15 buildpacks participating
    [creator]     paketo-buildpacks/bellsoft-liberica 2.7.1
    [creator]     paketo-buildpacks/executable-jar    1.2.5
    [creator]     paketo-buildpacks/apache-tomcat     1.1.5
    [creator]     paketo-buildpacks/dist-zip          1.3.2
    [creator]     paketo-buildpacks/spring-boot       1.5.5
    [creator]     ---> ANALYZING
    [creator]     Previous image with name "docker.io/library/tm-provisioning:0.0.1-SNAPSHOT" not found
    [creator]     Skipping buildpack layer analysis
    [creator]     ---> BUILDING
    [creator]     
    [creator]     Paketo BellSoft Liberica Buildpack 2.7.1
    [creator]         Set $BPL_JVM_HEAD_ROOM to configure the headroom in memory calculation. Default 0.
    [creator]         Set $BPL_JVM_LOADED_CLASS_COUNT to configure the number of loaded classes in memory calculation. Default 35% of classes.
    [creator]         Set $BPL_JVM_THREAD_COUNT to configure the number of threads in memory calculation. Default 250.
    [creator]         Set $BP_JVM_VERSION to configure the Java version. Default 11.*.
    [creator]       BellSoft Liberica JRE 8.0.252: Contributing to layer
    [creator]         Downloading from https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jre8u252+9-linux-amd64.tar.gz
    [creator]         Verifying checksum
    [creator]         Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
    [creator]         Writing env.launch/JAVA_HOME.override
    [creator]         Writing env.launch/MALLOC_ARENA_MAX.override
    [creator]         Writing profile.d/active-processor-count.sh
    [creator]       Memory Calculator 4.0.0: Contributing to layer
    [creator]         Downloading from https://github.com/cloudfoundry/java-buildpack-memory-calculator/releases/download/v4.0.0/memory-calculator-4.0.0.tgz
    [creator]         Verifying checksum
    [creator]         Expanding to /layers/paketo-buildpacks_bellsoft-liberica/memory-calculator
    [creator]         Writing profile.d/memory-calculator.sh
    [creator]       Class Counter: Contributing to layer
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/class-counter
    [creator]       JVMKill Agent 1.16.0: Contributing to layer
    [creator]         Downloading from https://github.com/cloudfoundry/jvmkill/releases/download/v1.16.0.RELEASE/jvmkill-1.16.0-RELEASE.so
    [creator]         Verifying checksum
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/jvmkill
    [creator]         Writing env.launch/JAVA_OPTS.append
    [creator]       Link-Local DNS: Contributing to layer
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/link-local-dns
    [creator]         Writing profile.d/link-local-dns.sh
    [creator]       Java Security Properties: Contributing to layer
    [creator]         Writing env.launch/JAVA_OPTS.append
    [creator]         Writing env.launch/JAVA_SECURITY_PROPERTIES.override
    [creator]       Security Providers Configurer: Contributing to layer
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/security-providers-configurer
    [creator]         Writing profile.d/security-providers-classpath.sh
    [creator]         Writing profile.d/security-providers-configurer.sh
    [creator]       OpenSSL Certificate Loader: Contributing to layer
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/openssl-security-provider
    [creator]         Writing profile.d/openssl-certificate-loader.sh
    [creator]     
    [creator]     Paketo Executable JAR Buildpack 1.2.5
    [creator]         Writing env.launch/CLASSPATH
    [creator]       Process types:
    [creator]         executable-jar: java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
    [creator]         task:           java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
    [creator]         web:            java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
    [creator]     
    [creator]     Paketo Spring Boot Buildpack 1.5.5
    [creator]       Image labels:
    [creator]         org.springframework.boot.spring-configuration-metadata.json
    [creator]         org.springframework.boot.version
    [creator]     ---> EXPORTING
    [creator]     ERROR: failed to create launch cache: removing backup directory '/launch-cache/committed-backup': unlinkat /launch-cache/committed-backup/sha256:476cb0263a8f538fc72cbbe6bcbe70e08129d22a953b966115cb866d942e2b33.tar: permission denied

> Task :bootBuildImage FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootBuildImage'.
> Builder lifecycle 'creator' failed with status code 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 45s
2 actionable tasks: 2 executed
dareurdream
  • 241
  • 4
  • 13

2 Answers2

2

That seems to be build cache related (build cache corrupted). Your build log shows the used build cache:

...
 > Executing lifecycle version v0.7.5
 > Using build cache volume 'pack-cache-defc64ac2d6d.build'

As the Spring Boot Gradle Plugin (same as the spring-boot-maven-plugin) are an abstraction for Paketo.io and it's pack CLI, which is using Docker for the local builds, you should be able to find the build cache volume pack-cache-defc64ac2d6d.build with:

docker volume ls

This gives something like:

$ docker volume ls
DRIVER    VOLUME NAME
local     bellsoft-jre-config
local     pack-cache-defc64ac2d6d.build
local     pack-cache-defc64ac2d6d.launch
local     spring-cloud-config

Now delete the build cache either individually (docker volume rm pack-cache-defc64ac2d6d.build) - or simply remove all local Docker volumes that aren't used by a other container with:

docker volume prune

Now your build should run again.

jonashackt
  • 12,022
  • 5
  • 67
  • 124
0

So, apparently this action is not supported in the 16 version of java.

The problem was solved when I updated to the 17th version of java in the pom.xml.

see: https://github.com/paketo-buildpacks/bellsoft-liberica/issues/86

Yuval Raz
  • 96
  • 7