I am new at Docker and trying to build and run my own container with Spring Boot Application. It runs on Kotlin and Gradle. I have built the image with simply this command, provided by gradle with spring boot plugin (id("org.springframework.boot") version "2.7.0-SNAPSHOT")
gradlew bootBuildImage
As a result i am getting this. Here are the logs: https://pastebin.com/xMW82vcw
The problem is, while trying to run my built image i am getting this error.
C:\projects\monetka-app>docker run docker.io/library/monetka-app:0.0.1-SNAPSHOT
Setting Active Processor Count to 6
unable to determine class count
unable to walk /workspace
unable to open ZIP /workspace/META-INF/licenses/client-2.1.jar
read /workspace/META-INF/licenses/client-2.1.jar: is a directory
ERROR: failed to launch: exec.d: failed to execute exec.d file at path '/layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/memory-calculator': exit status 1
Here are the docker images i have locally in docker desktop. My gradle version is 7.4.1, and JDK in use is 17.
When you run
gradlew bootBuildImage
, you're using Cloud-Native buildpacks to generate the image. This is a bug in a tool installed by the buildpack.The Java Cloud-Native buildpack will install a tool called memory-calculator. This tool runs prior to your application starting up and sets up all the JVM memory flags that are required to keep the JVM from going past the defined memory limit you set. For example, if you set the memory limit of your container to be 1G, the memory calculator will adjust settings like
-Xmx
accordingly.To do this, the memory calculator needs to know how many class files you have in your application, so it searches for them. This process is failing because it sees something with an extension of
.jar
and so it's trying to read the number of class files in that JAR, however, what it's seeingMETA-INF/licenses/client-2.1.jar
isn't actually a JAR. It's a directory.I opened a bug report for you here: https://github.com/paketo-buildpacks/libjvm/issues/160
If you are able to remove the file
META-INF/licenses/client-2.1.jar
(or change so it doesn't have a.jar
extension) you should be able to work around this until we can resolve the issue.