Dockerfile构建nginx镜像

Dockerfile构建nginx镜像

[root@bogon ~]# mkdir /opt/docker-file
[root@bogon ~]# cd /opt/docker-file/
[root@bogon docker-file]# mkdir nginx
[root@bogon docker-file]# cd nginx/
[root@bogon nginx]# wget http://nginx.org/download/nginx-1.9.9.tar.gz
[root@bogon nginx]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
[root@bogon nginx]# vi Dockerfile    #必须大写
#this is my dockerfile
#verion 1.0
#auther zi hao

#Base imags
FROM centos    :默认从本地

#MAINTAINER
MAINTAINER zi hao

#ADD
ADD pcre-8.42.tar.gz /usr/local/src
ADD nginx-1.9.9.tar.gz /usr/local/src

#RUN
RUN yum install -y wget gcc gcc-c++ make openssl-devel
RUN useradd -s /sbin/nologin -M www

#WORKDIR
WORKDIR /usr/local/src/nginx-1.9.9
RUN ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.42 && make && make install
RUN echo "daemon off;" >> /usr/local/nginx/nginx.conf

ENV PATH /usr/local/ngix/sbin:$PATH
EXPOSE 80
CMD ["nginx"]

 

posted @ 2019-03-05 23:42  effortsing  阅读(467)  评论(0编辑  收藏  举报