最近在弄青龙面板,用ginx弄下域名,简单记录下
先拉取nginx镜像
docker pull nginx
2、查看是否拉取成功
docker images
3、使用命令在源主机上新建文件夹
mkdir -p nginx/{conf,html,log}
4、启动临时nginx
docker run -d --name nginx_test nginx
5、拷贝需要挂载的文件
docker cp nginx_test:/etc/nginx/conf.d /root/nginx/conf
docker cp nginx_test:/etc/nginx/nginx.conf /root/nginx/conf/nginx.conf
docker cp nginx_test:/usr/share/nginx/html/index.html /root/nginx/html/index.html
6、删除临时nginx
docker rm -f nginx_test
7、创建挂载的nginx
docker run -d -p 80:80 --name nginx \
-v /root/nginx/conf/conf.d:/etc/nginx/conf.d \
-v /root/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /root/nginx/html/index.html:/usr/share/nginx/html/index.html \
-v /root/nginx/log:/var/log/nginx \
nginx
验证:机器地址出现下图就可以了