I am trying to build a image for one Springboot java application using gradle 8.0.2 and java 19jdk imag
e …build is getting successful and I am able to create a image but when I login to container java jar is not running …If I manually trigger java jar application is getting started but its not getting started from the Dockerfile I am using CMD [“java”, “-jar”, “myapp.jar”]
its not getting started when I deploy on Kubernetes using the created image my pod is going in crash loopback as service is not started and getting an error in pod saying Unable to access myapp.jar
I have used ENTRYPOINT as well the container starts application when I use docker run to create a container but that also didn’t work giving same error in Kubernetes POD
I am using user root and have given executable permission to myapp.jar …The jar is available in container
Below is my Dockerfile for reference.
FROM gradle:8.0.2-jdk19 AS build
WORKDIR /home/gradle/src
COPY build.gradle settings.gradle gradlew ./
COPY gradle ./gradle
COPY src ./src
RUN ./gradlew build -x test
FROM openjdk:19-alpine
WORKDIR /app
COPY --from=build /home/gradle/src/build/libs/*.jar app.jar
EXPOSE 8080
CMD [“java”, “-jar”, “./app.jar”]
Can someone please suggest