拉镜像
bash
docker pull nginx
运行初始镜像
bash
docker run -d -p 80:80 --name nginx nginx
拷贝文件
bash
docker cp nginx:/etc/nginx/nginx.conf D:/dockerFile/nginx/nginx.conf
docker cp nginx:/etc/nginx/conf.d D:/dockerFile/nginx/conf.d
docker cp nginx:/usr/share/nginx/html D:/dockerFile/nginx/
停止并删除刚刚的容器,重新运行容器
bash
docker stop [nginx_id]
docker rm [nginx_id]
bash
docker run -d --privileged=true -p 80:80 -v D:/dockerFile/nginx/nginx.conf:/etc/nginx/nginx.conf -v D:/dockerFile/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf -v D:/dockerFile/nginx/log:/var/log/nginx -v D:/dockerFile/nginx/html:/usr/share/nginx/html --name mynginx nginx

宿主机修改文件

重新进入
