问题原文
原帖链接 · Wissam Roujoulah · CC BY-SA 3.0
When we use "-v" argument in "docker run" command, we can specify {src path from host}:{path in container}, e.g
docker run -v /var/volumns/v1:/var/docker/v1ref ...
But, how about mounting a data-only container?
docker run --volumes-from data-only-container:<here is mode, ro or rw>
How I can achieve the same when using "-v"? Can I mount it to a specific folder?
已采纳解答
原帖链接 · Carlos Rafael Ramirez · CC BY-SA 3.0
I am afraid that the direct answer to your question is: no, you can't. volumes-from import the volumes exactly as they are defined in the other container.
Since docker 1.9 volume containers are being replaced with named volumes as the recommended practice. With named volumes you can mount it wherever you want :
docker volume create --name data
docker run -v data:/var/docker/v1ref ...
Regards
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
