1、原来的dockerfile,基于centos:7构建一个安装了jdk的镜像FROM centos:7
MAINTAINER wenyoulong <3424675994@qq.com>
ENV JAVA_HOME /usr/local/java/jdk1.8.0_181ENV JRE_HOME ${JAVA_HOME}/jreENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/libENV PATH ${JAVA_HOME}/bin:$PATH
COPY jdk-8u181-linux-x64.tar.gz /java/jdk-8u181-linux-x64.tar.gzCOPY 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.gzCOPY setup.sh /tomcat/setup.sh
CMD ["sh", "/tomcat/setup.sh"]
3、构建完成后运行tomcat这个镜像发现之前的那个镜像指定的CMD没有执行
添加回答
举报
0/150
提交
取消