0

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.

1 Answers1

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