3

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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