1、Pull
docker pull qys123888/alpine-nginx-image:v3.14.0(可以上传本地镜像)
2、Running
docker run -d --restart=always -p 8081:80 -p 443:443 --name nginx qys123888/alpine-nginx-image:v3.14.0
3、Webroot|Confpath|Logspath
/usr/local/nginx/html
/usr/local/nginx/conf
/usr/local/nginx/logs
4、Bash-demo
tee ./nginx.sh <<-'EOF'
#!/bin/bash
docker rm -f nginx
rm -rf /vdb/nginx/* -rf &&
mkdir /vdb/nginx -p &&
docker run -d --restart=always --name nginx qys123888/alpine-nginx-image:v3.14.0 sleep 3600 &&
docker cp nginx:/usr/local/nginx/conf /vdb/nginx/conf &&
docker cp nginx:/usr/local/nginx/html /vdb/nginx/html &&
docker cp nginx:/usr/local/nginx/logs /vdb/nginx/logs &&
docker rm -f nginx &&
chmod -R 777 /vdb/nginx &&
docker run -d --restart=always
-p 8081:80
-p 443:443
-v /vdb/nginx/conf:/usr/local/nginx/conf
-v /vdb/nginx/html:/usr/local/nginx/html
-v /vdb/nginx/logs:/usr/local/nginx/logs
--name nginx
qys123888/alpine-nginx-image:v3.14.0;
EOF
chmod +x ./nginx.sh &&
./nginx.sh;
4、 Reload
docker exec -it nginx nginx_reload
5、Get-version
docker exec -it nginx nginx -v
nginx version: BUILD20210827055300/1.21.1