拉取nginx镜像
docker pull nginx:latest
利用nginx镜像运行名叫nginxtest容器
docker run -d -p 10030:80 -it --name nginxtest nginx
把nginxtest容器的文件拷贝到本机
docker cp nginxtest:/etc/nginx/nginx.conf /NW_Portal/apps/firewall_nginx/conf/nginx.conf
docker cp nginxtest:/etc/nginx/conf.d /NW_Portal/apps/firewall_nginx/conf/conf.d
对nginxtest容器操作
docker stop nginxtest
docker rm nginxtest
以bash方式进入nginx容器
docker exec -it nginxtest bash
利用nginx镜像运行名叫nginx的容器,并映射文件到本地
docker run --name nginx -d -p 10030:80 \
-v /NW_Portal/apps/firewall_nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro \
-v /NW_Portal/apps/firewall_nginx/conf/conf.d:/etc/nginx/conf.d \
-v /NW_Portal/apps/firewall_nginx/html:/usr/share/nginx/html \
-v /NW_Portal/logs/firewall_nginx:/var/log/nginx \
-d nginx:latest
利用nginx镜像运行名叫nginx的容器,并开放了多个端口和映射文件到本地
docker run --name nginx -d \
-p 9850:9850 \
-p 9860:9860 \
-p 9870:9870 \
-v /home/miege/nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro \
-v /home/miege/nginx/conf/conf.d:/etc/nginx/conf.d \
-v /home/miege/nginx/html:/usr/share/nginx/html \
-v /home/miege/nginx/logs:/var/log/nginx \
-d nginx:latest
利用nginx镜像运行名叫nginx的容器,并映射文件到本地
```powershell