我有一个版本为17.06.0-ce的docker.当我尝试使用docker with command安装Nginx时:
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: 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文件,一切都还可以.那么,我该如何挂载配置文件呢?
谢谢.
解决方法:
因为docker将$PWD / conf / Nginx.conf识别为文件夹而不是文件.
检查$PWD / conf /目录是否包含Nginx.conf作为目录.
试试吧
> cat $PWD/conf/Nginx.conf
cat: Nginx.conf/: Is a directory
否则,打开一个Docker issue.
它配置相同,对我来说很好.