Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
695 views
in Technique[技术] by (71.8m points)

在 docker 中安装 nginx.conf 挂载失败

是的,我快疯了

docker run -d
--name nginx
--restart=always
-p 4000:80
-v /share/Container/nginx/html:/usr/share/nginx/html
-v /share/Container/nginx/log:/var/log/nginx
-v /share/Container/nginx/conf.d:/etc/nginx/conf.d
-v /share/Container/nginx/nginx.conf:/etc/nginx ginx.conf:ro
nginx

当然先跑了一个官方没有挂载的镜像,然后把内容复制到宿主机,然后 docker run 一下,没有报错可以跑起来 我修改宿主机挂载 html 中的欢迎界面也是可以有对应的改变 但是当我修改 nginix.conf 宿主机的问件时,哪怕我把他删了,重载配置文件后欢迎页依旧坚挺

试过两边都是目录,两边都是文件的各种挂载方法,都不行?

谁能救救我,我快疯了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

自己提问自己回答,问题解决了,原因是

/etc/nginx ginx.conf:ro

应该是

/etc/nginx/nginx.conf


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

547k answers

4 comments

35.3k users

...