L Download First Nginx the configuration file wget http://www.apelearn.com/study_v2/.nginx_conf
L vim Dockerfile// The contents are as follows
############################################################
# Dockerfile to build Nginx installed Containers
# Based on CentOS
############################################################
# Set The base image to CentOS
From CentOS
# File Author/maintainer
Maintainer aming [email protected]
# Install Necessary Tools
RUN Yum install-y pcre-devel wget net-tools gcc
RUN Yum install-y zlib zlib-devel make
RUN Yum install-y 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
L RUN cd nginx-1.8.0.tar.gz &&./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
entrypoint /usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
L To create a mirror:
L Docker build-t Centos_nginx.
L Docker Images you can see our new image.
dockerfile Example-nginx