Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Docker image that used JAVA 11

I have been working with Spring boot and Docker. I used to build docker image of applications on JAVA 8. But now i need to build the docker image of application that use JAVA 11. Please guide me about this.

Dockerfile

FROM openjdk:8u121-jdk-alpine
ENV APP_JAR_NAME applicationTest
RUN apk --update add curl bash && 
rm -rf /var/cache/apk/*

RUN mkdir /app
ADD ${APP_JAR_NAME}.jar /app/
ADD run.sh /app/
RUN chmod +x /app/run.sh
WORKDIR /app
EXPOSE 8080
ENTRYPOINT ["/bin/bash","-c"]
CMD ["/app/run.sh"]

Request please share the Dockerfile that i could used for building docker image of JAVA 11

like image 547
Lily Avatar asked Jan 31 '26 03:01

Lily


1 Answers

Just change version (FROM) to adoptopenjdk/openjdk11, from the Overview:

FROM adoptopenjdk/openjdk11:latest
RUN mkdir /opt/app
COPY japp.jar /opt/app
CMD ["java", "-jar", "/opt/app/japp.jar"]
like image 104
tsarenkotxt Avatar answered Feb 01 '26 21:02

tsarenkotxt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!