安装Nginx的Dockerfile实例

################################################
#Dockerfile to build Nginx Installed Containers#
#Based on CentOS                                      #
################################################
#Set the base image to CentOS
FROM centos
#File Author / Maintainer
MAINTAINER fansik shandingshangdeyu@hotmail.com

#Install necessary tools
RUN yum install -y pcre-devel wget net-tools gcc zlib zlib-devel make openssl-devel

#Install Nginx
ADD http://nginx.org/download/nginx-1.8.0.tar.gz .
RUN tar zxvf nginx-1.8.0.tar.gz
RUN mkdir -p /usr/local/nginx
RUN cd nginx-1.8.0 && ./configure --prefix=/usr/local/nginx && make && make install
RUN rm -fv /usr/local/nginx/conf/nginx.conf
COPY nginx.conf /usr/local/nginx/conf/nginx.conf

#Expose ports
EXPOSE 80

#Set the default command to execute
#when creating a new container
#CMD /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

原文地址:https://www.cnblogs.com/fansik/p/5541308.html