docker nginx镜像 获取并挂载目录

docker pull nginx

docker images
cd /usr/local

mkdir -p ./nginx/www ./nginx/logs ./nginx/conf

docker run --name nginx-test -p 80:80 -d nginx

docker ps -a

docker cp nginx-test:/etc/nginx/nginx.conf ./nginx/conf

docker cp nginx-test:/etc/nginx/conf.d ./nginx/conf.d

docker stop nginx-test
docker rm nginx-test

docker run -d -p 80:80 --name nginx -v /usr/local/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /usr/local/nginx/logs:/var/log/nginx -v /user/local/nginx/conf.d:/etc/nginx/conf.d nginx

docker ps -a

 

 


posted @ 2022-05-04 09:57  喵喵2023  Views(265)  Comments(0Edit  收藏  举报