docker pull registry.cn-hangzhou.aliyuncs.com/ns-w/wh-w:nginx-1.22.0
创建挂载目录
mkdir -p /opt/resource/nginx/conf mkdir -p /opt/resource/nginx/log mkdir -p /opt/resource/nginx/html
生成容器
docker run --name nginx-1.22.0 -p 80:80 -d registry.cn-hangzhou.aliyuncs.com/ns-w/wh-w:nginx-1.22.0
docker cp nginx-1.22.0:/etc/nginx/nginx.conf /opt/resource/nginx/conf/nginx.conf docker cp nginx-1.22.0:/etc/nginx/conf.d /opt/resource/nginx/conf/conf.d docker cp nginx-1.22.0:/usr/share/nginx/html /opt/resource/nginx/
删除正在运行的nginx容器
docker rm -f nginx-1.22.0
docker run
-p 80:80
--name nginx-1.22.0
--restart=always
-v /opt/resource/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
-v /opt/resource/nginx/conf/conf.d:/etc/nginx/conf.d
-v /opt/resource/nginx/log:/var/log/nginx
-v /opt/resource/nginx/html/dist:/usr/share/nginx/html
-d registry.cn-hangzhou.aliyuncs.com/ns-w/wh-w:nginx-1.22.0