您是否尝试将目录挂载到文件上(反之亦然)? [英] Are you trying to mount a directory onto a file (or vice-versa)?

查看:43
本文介绍了您是否尝试将目录挂载到文件上(反之亦然)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个版本为 17.06.0-ce 的 docker.当我尝试使用带有命令的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆