Search code examples
javadockerkubernetesdeploymentjar

Unable to access jarfile docker using distroless-debug


I switched from distroless/java:8 to distroless/java:8-debug container and, when deployed to kubernetes, I started getting following error: Error: Unable to access jarfile /MyApp-0.1.jar

This is my Dockerfile:

FROM gcr.io/distroless/java:8-debug
LABEL CONTAINER_NAME=my-api
ARG JAR_FILE=MyApp/core/build/libs/core-0.1-boot.jar
COPY ${JAR_FILE} MyApp-0.1.jar
ENTRYPOINT ["java","-jar","/MyApp-0.1.jar"]

While I was using regular distroless (everything else was the same) I didn't have this problem. What is interesting is that when I try to run this Dockerfile locally, I don't get this error. Is this some permission issue?


Solution

  • I redeployed and it is working now. The only logical explanation is that I tried to use nonroot one first and when I switched to root one, some of the pods with nonroot were still there causing the problem.