标签:docker
方案一: Docker创建时利用wget下载Tomcat最新版本构建
# CentOS 7 + Oracle JDK 7 + Tomcat 7 FROM centos:centos7 MAINTAINER yuj <67215686@qq.com> 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"]
方案二: 利用Docker服务器上已下载的Tomcat压缩包构建(这里使用的是apache-tomcat-7.0.63.tar.gz)
# CentOS 7 + Oracle JDK 7 + Tomcat 7 FROM centos:centos7 MAINTAINER yuj <67215686@qq.com> 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"]
使用Docker构建CentOS 7 + Tomcat 7 + Oracle JDK 7的WEB服务器
标签:docker
原文地址:http://sheepfish.blog.51cto.com/5047301/1679691