最近在弄青龍面板,用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
驗證:機器地址出現下圖就可以了