mkdir /opt/docker
cd /opt/docker
vi tomcat-dockerfile
#从那个镜像文件开始(依赖的镜像文件,以哪个发行的镜像为基础)
FROM centos
MAINTAINER xiaoshuaihui#创建jdk安装目录和tomcat安装目录
RUN mkdir /usr/local/javaADD jdk-7u76-linux-x64.tar.gz /usr/local/java
#配置java与tomcat环境变量
ENV JAVA_HOME /usr/local/java/jdk1.7.0_76
ENV CATALINA_HOME /opt/xvdb/tomcat_web
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
ENV LANG en_AG.utf8
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/binRUN mkdir /opt/xvdb
ADD apache-tomcat-8.5.53.tar.gz /opt/xvdb#重命名tomcat
RUN mv /opt/xvdb/apache-tomcat-8.5.53 /opt/xvdb/tomcat_web
#容器运行时监听的端口
EXPOSE 8080CMD ["/opt/xvdb/tomcat_web/bin/catalina.sh","run"]
cd /opt/docker
docker build -f /opt/docker/tomcat-dockerfile -t tomcat-8.5.53-jdk1.7:v1.0 .
docker run -d -p 8080:8080 --name tomcat_test-1 tomcat-8.5.53-jdk1.7:v1.0
6.验证
https://www.cnblogs.com/wherein/p/6862911.html