I have a base ubuntu docker image and am installing java 8 on it. I need to set java home in the docker file as tomcat needs it. How do i know the location of jre installed to set java home.
Asked
Active
Viewed 1.4k times
1 Answers
5
Best answer would be use docker official java image. Dockerfile
If you still want your own image with Java home set. Add this lines to your Dockerfile
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get clean && \
rm -rf /var/lib/apt/lists/ && \
rm -rf /var/cache/oracle-jdk8-installer;
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME

Jinna Balu
- 6,747
- 38
- 47
-
yes, but wanted to explore a way to do it on base linux image. – gauravparmarbliss Oct 17 '17 at 17:42
-
https://hub.docker.com/_/java/, go through this link will help you on different images alpine, slim and many other options too. go through all Dockerfiles, you will find the help – Jinna Balu Oct 17 '17 at 17:56