docker 安装nginx
/opt/nginx下创建文件夹 www、logs、conf
在conf下创建文件夹conf.d
docker run --name nginx-test -p 8080:80 -d nginx
docker cp nginx-test:/etc/nginx/nginx.conf /opt/nginx/conf
docker cp nginx-test:/etc/nginx/conf.d/default.conf /opt/nginx/conf/conf.d
docker stop nginx-test
sudo docker run -d -p 8080:80 --name nginx -v /opt/nginx/www:/usr/share/nginx/html -v /opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /opt/nginx/conf/conf.d/default.conf:/etc/nginx/conf/conf.d/default.conf -v /opt/nginx/logs:/var/log/nginx nginx
# docker run --name nginx
# -p 80:80
# -v /opt/nginx/html:/usr/share/nginx/html
# -v /opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
# -v /opt/nginx/logs:/var/log/nginx
# -v /opt/nginx/conf.d:/etc/nginx/conf.d
# -v /etc/localtime:/etc/localtime:ro
# -d nginx