installation
Docker pulling Nginx mirror:
docker pull nginx
docker images
Create a mount directory:
mkdir -p /Users/acton_zhang/mydocker/mynginx/{conf,conf.d,html,logs}
Enter the vessel and view the profile directory structure:
docker run -i -t nginx /bin/bash
copy container configuration file to the host file you just created the following:
docker cp 4d65624dc26c:/etc/nginx/nginx.conf /Users/acton_zhang/mydocker/mynginx/conf/nginx.conf
docker cp 4d65624dc26c:/etc/nginx/conf.d/default.conf /Users/acton_zhang/mydocker/mynginx/conf.d/default.conf
Write default.conf profile:
The port to 81:
Mount and start Nginx:
docker run -p 81:81 --name mynginx --privileged=true -v /Users/acton_zhang/mydocker/mynginx/html:/usr/share/nginx/html -v /Users/acton_zhang/mydocker/mynginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /Users/acton_zhang/mydocker/mynginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf -v /Users/acton_zhang/mydocker/mynginx/logs:/var/log/nginx -d nginx
Good writing html files into html inside, then enter in the browser http: // ip: 81 Port: