1、原来的dockerfile,基于centos:7构建一个安装了jdk的镜像
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、基于刚刚构建的镜像构建一个安装了tomcat的新镜像
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、构建完成后运行tomcat这个镜像发现之前的那个镜像指定的CMD没有执行
largeQ
相关分类