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?


1 Answer 1


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 ...


  • You can fill the container initially from a container, but you can't keep it synchronized, plus it takes up additional space. But there are some ways to do it, see stackoverflow.com/q/48186109/201725
    – Jan Hudec
    Sep 19, 2022 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.