docker安装nginx并进行-v挂载
作者:互联网
运行一个nginx容器:
docker run -d -p 80:80 --name nginx zhangxueliang2020/nginx:v1.19.3
将nginx容器中的配置文件nginx.conf拷贝到本地:
root@debian:/home/zxl/workspace/docker/nginx# docker cp nginx:/etc/nginx/nginx.conf /home/zxl/workspace/docker/nginx/conf/nginx.conf
root@debian:/home/zxl/workspace/docker/nginx# ls conf
nginx.conf
进行目录及配置文件的挂载:
docker run -d -p 80:80 --name nginx -v /home/zxl/workspace/docker/nginx/www:/usr/share/nginx/html -v /home/zxl/workspace/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /home/zxl/workspace/docker/nginx/conf/conf.d:/etc/nginx/conf.d -v /home/zxl/workspace/docker/nginx/logs:/var/log/nginx zhangxueliang2020/nginx:v1.19.3
一定要有
nginx.conf
配置文件,否则报错。
标签:workspace,zxl,nginx,conf,挂载,home,docker 来源: https://blog.51cto.com/u_7692005/2984010