Scenario One: Use wget to download the latest version of Tomcat build when Docker is created
# centos 7 + oracle jdk 7 + tomcat 7 from centos:centos7 MAINTAINER yuj <[email protected]> run yum install -y java-1.7.0-openjdk.x86_64 wget tar env tomcat_major_version 7 env tomcat_minor_version 7.0.63 workdir /opt/ run wget -o /opt/tomcat7.tar.gz http://www.us.apache.org/dist/tomcat/tomcat-7/v${tomcat _minor_version}/bin/apache-tomcat-${tomcat_minor_version}.tar.gz -q && \ tar -xzf /opt/tomcat7.tar.gz && \ rm /opt/tomcat7.tar.gz && \ ln -s apache-tomcat-$TOMCAT _minor_version tomcat add create_tomcat_admin_user.sh /opt/create_tomcat_admin_user.sh ADD start.sh /opt/start.sh env catalina_home /opt/tomcat expose 8080 cmd ["/opt/start.sh"]
Scenario Two: Build with the Tomcat compression package downloaded on the Docker server (apache-tomcat-7.0.63.tar.gz is used here)
# centos 7 + oracle jdk 7 + tomcat 7 from centos:centos7 maintainer yuj <[email protected ]> run yum install -y java-1.7.0-openjdk.x86_64 wget tar env tomcat_major_version 7 ENV TOMCAT_MINOR_VERSION 7.0.63 ADD Apache-tomcat-7.0.63.tar.gz /opt/ workdir /opt/ run ln -s apache-tomcat-$TOMCAT _minor_version tomcat add create_tomcat_admin_user.sh /opt/create_tomcat_admin_user.sh add start.sh /opt/start.sh env catalina_home /opt/tomcat expose 8080 cmd ["/opt/stArt.sh "]
Use Docker to build a Web server for CentOS 7 + Tomcat 7 + Oracle JDK 7