FROM ubuntu:18.04
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
COPY jdk-8u211-linux-x64.tar.gz /opt
RUN mkdir -p /usr/lib/jvm/
RUN tar -zxf /opt/jdk-8u211-linux-x64.tar.gz -C /usr/lib/jvm/ &&\
mv /usr/lib/jvm/jdk1.8.0_211 /usr/lib/jvm/java-8-oracle
RUN ls -l /usr/lib/jvm/java-8-oracle
RUN update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-oracle/jre/bin/java 2000 &&\
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-8-oracle/bin/javac 2000 &&\
update-alternatives --config java &&\
update-alternatives --config javac
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-oracle" >> ~/.bashrc
RUN rm -rf /opt/jdk-8u211-linux-x64.tar.gz
网友评论