centos7.9+jdk-8u231 dockerfile实例:
# CentOS with JDK 8
# Author xx@xx.com
# build a new image with basic centos
FROM centos:centos7.9.2009
# who is the author
MAINTAINER xx@xx.com
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# make a new directory to store the jdk files
RUN mkdir /opt/software \
&& yum -y install vim net-tools telnet tree wget curl \
&& yum clean all
# copy the jdk archive to the image,and it will automaticlly unzip the tar file
ADD jdk-8u231-linux-x64.tar.gz /opt/software
# set environment variables
ENV JAVA_HOME /opt/software/jdk1.8.0_231
ENV JRE_HOME ${JAVA_HOME}/jre
ENV CLASSPATH .:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
ENV PATH ${JAVA_HOME}/bin:$JRE_HOME/bin:$PATH