使用Dockerfile 构建jdk镜像

Dockerfile

FROM centos:latest
MAINTAINER "xqghp"<xqghp@126.com>
ADD jdk-8u171-linux-x64.tar.gz /opt
RUN ln -s /opt/jdk1.8.0_171 /opt/jdk
ENV JAVA_HOME  /opt/jdk
ENV PATH  $PATH:$JAVA_HOME/bin
ENV CLASSPATH  .:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
CMD java -version
docker build -t  xqhgp/java .

docker images

docker tag 197beb941e56 xqghp/java:1.0