您是否正在尝试将目录挂载到文件上(反之亦然)? [英] Are you trying to mount a directory onto a file (or vice-versa)?
问题描述
我有一个版本为17.06.0-ce
的码头工人.当我尝试使用带有命令的docker安装NGINX时:
I have a docker with version 17.06.0-ce
. When I trying to install NGINX using docker with command:
docker run -p 80:80 -p 8080:8080 --name nginx -v $PWD/www:/www -v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf -v $PWD/logs:/wwwlogs -d nginx:latest
它表明了
docker:来自守护程序的错误响应:oci运行时错误: container_linux.go:262:启动容器过程引起 "process_linux.go:339:容器初始化导致\" rootfs_linux.go:57: 将\\"/appdata/nginx/conf/nginx.conf \\"安装到rootfs \\"/var/lib/docker/aufs/mnt/dcea22444e9ffda114593b18fc8b574adfada06947385aedc2ac09f199188fa0 \\" 在 \\"/var/lib/docker/aufs/mnt/dcea22444e9ffda114593b18fc8b574adfada06947385aedc2ac09f199188fa0/etc/nginx/nginx.conf \\" 导致\\不是目录\\" \" :您是否正在尝试将目录挂载到文件上(反之亦然)?检查指定的主机路径是否存在以及是否为预期的类型.
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:57: mounting \\"/appdata/nginx/conf/nginx.conf\\" to rootfs \\"/var/lib/docker/aufs/mnt/dcea22444e9ffda114593b18fc8b574adfada06947385aedc2ac09f199188fa0\\" at \\"/var/lib/docker/aufs/mnt/dcea22444e9ffda114593b18fc8b574adfada06947385aedc2ac09f199188fa0/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.
如果不挂载nginx.conf
文件,则一切正常.那么,如何挂载配置文件?
If do not mount the nginx.conf
file, everything is okay. So, how can I mount the configuration file?
推荐答案
因为docker将$PWD/conf/nginx.conf
识别为文件夹,而不是文件.检查$PWD/conf/
目录是否包含nginx.conf
作为目录.
Because docker will recognize $PWD/conf/nginx.conf
as a folder and not as a file. Check whether the $PWD/conf/
directory contains nginx.conf
as a directory.
使用
> cat $PWD/conf/nginx.conf
cat: nginx.conf/: Is a directory
否则,打开 Docker问题.
使用相同的配置,对我来说效果很好.
Otherwise, open a Docker issue.
It's working fine for me with same configuration.
这篇关于您是否正在尝试将目录挂载到文件上(反之亦然)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!