Dockerfile文件内容:
#使用基础镜像
FROM centos
#作者信息
MAINTAINER doublesguns "lz_mic2016@outlook.com"
#创建目录
RUN mkdir -p /usr/local/java1.8
#把当前目录下的jdk文件夹添加到镜像
ADD jdk8 /usr/local/java1.8
RUN mkdir -p /usr/local/tomcat7
ADD tomcat7 /usr/local/tomcat7
#添加环境变量
ENV JAVA_HOME /usr/local/java1.8
ENV CATALINA_HOME /usr/local/tomcat7
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#暴露8080端口
EXPOSE 8080
#启动时运行tomcat
CMD ["/usr/local/tomcat7/bin/catalina.sh", "run"]