docker pull nginx:latest
# 第一个80端口是主机端口,第二个80端口是内部端口,主机的端口 80 映射到容器内部的端口80
docker run -d --name nginx -p 80:80 -p 443:443 nginx:latest
# nginx目录
mkdir /usr/local/nginx
# nginx子目录
mkdir /usr/local/nginx/conf
mkdir /usr/local/nginx/html
mkdir /usr/local/nginx/logs
docker cp d14:/etc/nginx/nginx.conf /usr/local/nginx/
docker cp d14:/etc/nginx/conf.d /usr/local/nginx/conf/
docker cp d14:/usr/share/nginx/html /usr/local/nginx/html
docker cp d14:/var/log/nginx/ /usr/local/nginx/logs/
docker ps -a
docker stop d14
docker rm d14
docker run -d --name nginx -p 80:80 -p 443:443 -v /usr/local/nginx/nginx.conf:/etc/nginx/nginx.conf -v /usr/local/nginx/logs:/var/log/nginx -v /usr/local/nginx/html:/usr/share/nginx/html -v /usr/local/nginx/conf:/etc/nginx/conf.d --privileged=true -e TZ=Asia/Shanghai nginx:latest