从https://blog.csdn.net/u010148813/article/details/126172372 摘要的内容
1.下载镜像
docker pull nginx:1.22.0
2.创建挂载目录
mkdir /root/apply/docker/apply/nginx
3.从容器中复制要挂载的文件
docker run --name nginx1.22 -p 10080:80 -d nginx:1.22.0
docker cp nginx1.22:/etc/nginx/nginx.conf /root/apply/docker/apply/nginx
docker cp nginx1.22:/etc/nginx/conf.d/ /root/apply/docker/apply/nginx/conf.d
docker cp nginx1.22:/usr/share/nginx/html/ /root/apply/docker/apply/nginx/html
docker cp nginx1.22:/var/log/nginx/ /root/apply/docker/apply/nginx/logs
docker stop nginx1.22
docker rm nginx1.22
4.创建并运行容器
docker run -p \
-v /root/apply/docker/apply/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v /root/apply/docker/apply/nginx/logs:/var/log/nginx \
-v /root/apply/docker/apply/nginx/html:/usr/share/nginx/html \
-v /root/apply/docker/apply/nginx/conf:/etc/nginx/conf.d \
-v /etc/localtime:/etc/localtime \
--name nginx1.22 \
--net=host \
--restart=always \
-d nginx:1.22.0
标签:nginx1.22,root,nginx,conf,apply,docker,安装
From: https://www.cnblogs.com/-zhiwei-/p/17425795.html