1. The original dockerfile, builds an image with jdk installed based on centos:7
FROM centos:7
MAINTAINER wenyoulong < 3424675994@qq.com >
ENV JAVA_HOME / usr/local/java/jdk1.8.0_181
ENV JRE_HOME ${JAVA_HOME} / jre
ENV CLASSPATH.: ${JAVA_HOME} / lib:$ {JRE_HOME} / lib
ENV PATH ${JAVA_HOME} / bin:$PATH
COPY jdk-8u181-linux-x64.tar.gz / java/jdk-8u181-linux-x64.tar.gz
COPY setup.sh / java/setup.sh
CMD ["sh", "/ java/setup.sh"]
2. Build a new image with tomcat installed based on the image you just built
FROM my-java:latest
MAINTAINER wenyoulong < 3424675994@qq.com >
COPY apache-tomcat-8.5.33.tar.gz / tomcat/apache-tomcat-8.5.33.tar.gz
COPY setup.sh / tomcat/setup.sh
CMD ["sh", "/ tomcat/setup.sh"]
3. Run tomcat after the completion of the construction and discover that the CMD specified by the mirror did not execute