#本地已有鏡像 FROM docker.io/centos #做者信息 MAINTAINER liangyj liangyj@566560.com #安裝包文件 RUN yum install -y gcc pcre pcre-devel zlib zlib-devel bzip2 bzip2-devel make #下載並解壓nginx WORKDIR /usr/local/src RUN wget http://nginx.org/download/nginx-1.8.0.tar.gz RUN tar xzvf nginx-1.8.0.tar.gz WORKDIR /usr/local/src/nginx-1.8.0 #編譯安裝nginx RUN ./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre RUN ["make"] RUN ["make","install"] EXPOSE 80 #刪除nginx源碼包及解壓後文件 RUN rm -rf /usr/local/src/nginx-1.8.0.tar.gz RUN rm -rf /usr/local/src/nginx-1.8.0 #CMD["/usr/local/nginx/sbin/nginx","-c","/usr/local/nginx/conf/nginx.conf"]