写了一个简单的 nginx+tomcat7的dockerfile 分享给大家
FROM centos
MAINTAINER LINCOLN_ZHONG
ENV LANG en_US.UTF-8
ENV JAVA_HOME=/jdk1.8
ENV PATH $PATH:$JAVA_HOME/bin
ENV CATALINA_BASE=/tomcat7
ENV CATALINA_HOME=/tomcat7
ENV CATALINA_TMPDIR=/tomcat7/temp
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
WORKDIR /root
RUN yum install -y vim wget gcc gcc-c++ make zlib-devel telnet gpm-libs glibc-headers
RUN wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz
RUN tar zxvf pcre-8.38.tar.gz && cd pcre-8.38 && ./configure && make && make install
COPY jdk-8u92-linux-x64.tar.gz /root/jdk-8u92-linux-x64.tar.gz
RUN tar -zxvf jdk-8u92-linux-x64.tar.gz -C /
RUN mv /jdk1.8.0_92 /jdk1.8
COPY nginx-1.8.1.tar.gz /root/nginx-1.8.1.tar.gz
RUN tar -zxvf nginx-1.8.1.tar.gz && cd nginx-1.8.1 && ./configure && make && make install
COPY apache-tomcat-7.0.69.tar.gz /root/apache-tomcat-7.0.69.tar.gz
RUN tar -zxvf apache-tomcat-7.0.69.tar.gz -C /
RUN mv /apache-tomcat-7.0.69 /tomcat7
EXPOSE 80
EXPOSE 8080
CMD [ "/tomcat7/bin/startup.sh" , "/usr/local/nginx/sbin/nginx -g "daemon off;"]
注意: jdk-8u92-linux-x64.tar.gz和nginx-1.8.1.tar.gz 需要自己手动下载并放在和dockerfile同一目录下!