Docker-无法在现有文件上装载卷,文件存在 [英] Docker - cannot mount volume over existing file, file exists
问题描述
我正在尝试为Docker中的应用程序构建数据容器.我运行以下命令以显示一些卷:
I'm trying to build a data container for my application in Docker. I run this command to expose some volumes:
docker run --name svenv.nl-data -v /etc/environment -v /etc/ssl/certs -v /var/lib/mysql -d svenv/svenv.nl-data
问题是我从以下命令得到此错误:
The problem is that i get this error from this command:
Error response from daemon: cannot mount volume over existing file, file exists /var/lib/docker/aufs/mnt/aefa66cf55357e2e1e4f84c2d4d2d03fa2375c8900fe3c0e1e6bc02f13e54d05/etc/environment
如果我正确理解Docker文档.支持为单个文件创建卷.所以我不明白为什么会收到这个错误.
If I understand the Docker documentation correctly. Creating volumes for single files is supported. So I don't understand why I get this error.
有人可以向我解释吗?我正在Ubuntu 14.04上运行Docker 1.9.1.
Is there somebody who can explain this to me? I'm running Docker 1.9.1 on Ubuntu 14.04.
推荐答案
您应使用:
-v /etc/environment:/etc/environment
代替:
-v /etc/environment
前者将容器卷映射到主机卷.
后者尝试在/etc/environment
处创建一个新卷,但由于该目录已存在而失败.
The former maps container volume to the host volume.
The latter tries to create a new volume at /etc/environment
and fails since this directory already exists.
这篇关于Docker-无法在现有文件上装载卷,文件存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!