nginx 容器无法启动,去掉文件映射启动正常

来源:6-1 后端项目后端项目部署与负载均衡

yyy_ooo

2018-07-13

[root@localhost n1]# docker run -it -d --name n1 -v /home/n1/nginx.conf:/etc/nginx/nginx.conf --net=host --privileged nginx

5e3388d14ae0cb37f12667a685cf8a76b86af8926c185f4277688e24563f8327

/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:364: container init caused \"rootfs_linux.go:54: mounting \\\"/home/n1/nginx.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/2b97634b2e49e7d3c48cc16dd7b9e367179d8edaf9c1257b24dfca761211a069/merged\\\" at \\\"/var/lib/docker/overlay2/2b97634b2e49e7d3c48cc16dd7b9e367179d8edaf9c1257b24dfca761211a069/merged/etc/nginx/nginx.conf\\\" caused \\\"not a directory\\\"\""

: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.

另一个问题是生产环境是不是一般用拷贝文件比映射文件要好

写回答

1回答

神思者

2018-07-13

同学你好,宿主机上有/home/n1/nginx.conf这个文件么?如果希望体现容器的完全隔离型,当然是上传文件到容器中是最好的。

0
4
神思者
docker logs 容器名称,刚才打错了
2018-07-14
共4条回复

Docker环境下的企业级前后端分离项目部署与运维

手把手带你学会项目分布式集群部署,让你的系统不再惧怕宕机

2459 学习 · 1018 问题

查看课程