Anand Patel
Anand Patel

Reputation: 6431

How is docker able to mount a volume from docker client into a docker container running on docker host?

I am using docker toolbox on Mac. The setup looks like:

docker host - Boot2Docker VirtualBox VM running on Mac

docker client - Mac

I am using following command - docker run -it -v $PWD/dir_on_docker_client:/dir_inside_container ubuntu:14.04 /bin/bash to run a container with a volume mount. I wonder, how is docker able to mount volume from docker client (in this case Mac) into a docker container running on docker host (in this case, VM running on Mac)?

Upvotes: 0

Views: 282

Answers (2)

ateles
ateles

Reputation: 422

The toolbox VM includes a shared directory from the client. /c/Users (C:\Users) on Windows and /Users on Mac.

Directories in these folders, on the client, can be added as volumes in a container.

Note though that if you add for example /tmp as a volume, it will be /tmp in the toolbox.

Upvotes: 1

GianArb
GianArb

Reputation: 1684

The main problem is that virtulbox shares only your home folder with the docker machine at the moment you can only shares content inside this directory. It's uncomfortable but the unique way that I fund to resolve this problem is with the bootlocal.sh file, you can write this file inside your docker-machine to mount after the boot new directory

https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md#local-customisation-with-persistent-partition

Yesterday during this dockercon they announced a public beta for "Docker For Mac", I think that you can replace docker-machine with this tool, it provide the best experience with docker and macos, and it resolves this problem https://www.docker.com/products/docker

Upvotes: 1

Related Questions