The first step is to download the nginx image
Docker Pull Nginx
Step two, partially modified
#This is a nginx dockerfile
#Source image
From Nginx
#Author
Maintainer Leonlong from dockerpool.conf [email protected]
#mount Point
Volume/opt/nginx/conf
Volume/var/log/nginx
Volume/opt/nginx/www
#Run Instructions
RUN echo "Asia/shanghai" >/etc/timezone && dpkg-reconfigure-f noninteractive tzdata
CMDnginx-g "daemon off;"
Note: The cmd instructions are all processes that start in non-daemon mode, and if you do not turn off daemon mode, you can see through Docker PS that the container's start will only be run once and end
The third step is to build your own image
cd/opt/docker/dockerfiles/nginx/;d ocker build-t nginx:private.
Fourth step, start
Create the relevant directory and launch the Docker container Nginx
Docker run-it-p 80:80-p 443:443-v/opt/docker/mounts/nginx/log:/var/log/nginx-v/opt/docker/mounts/nginx/conf:/opt/ Nginx/conf-v/opt/docker/mounts/nginx/www:/opt/nginx/www--name nginxtest nginx:private
This article is from the "Letter" blog, please be sure to keep this source http://leon0long.blog.51cto.com/3011404/1812330
Dockerfile Combat (i): Customize a simple Nginx service