Docker Community Forums

Share and learn in the Docker community.

How to share volumes and/or drives using docker-machine on Windows (not beta)?


(Anp31415) #1

Hi, I am running docker using docker-machine via VirtualBox on Windows.

When using the -v command the volume gets mounted, but docker container does not see the content of the Windows drive and likewise, if you create a file/directory in the mounted volume, you don’t see the changes back in Windows. suggests that sharing a drive is required using the Docker Beta machinery - something I am unable to install on my machine.

Any other ways of successfully establishing a bi-directional link to a Windows volume using docker-machine?

(Anp31415) #2

Well, I have solved the pickle myself.

/c/Users (lowercase c, uppercase U) is the solution

(Michael Friis) #3

(Michael Friis) #4

(Fithaabdulla) #5

Can you add a few points why it solved the problem ? Is it because ‘c’ is already mounted in boot2docker?

(Anp31415) #6

Open settings of your docker-machine VM in VirtualBox. Go to Shared Folders section. You will most likely find that c/Users (case-sensitive) is mapped to c:\Users.

(Senyor) #7

For VirtualBox shared folders to work with docker volumes, use the following commands (replace <full_project_path> with the real absolute path for the project):

docker-machine stop

vboxmanage sharedfolder add default --name "project_name" --hostpath "<full_project_path>" --automount

docker-machine start  

Then I prefer to use compose file and specify the source folder as "/project_name" like this:

  - /project_name:/some/dir/in/container/project_name

(Dgorjup) #8

This was extremely useful and surprisingly hard to find.

(Svalchinov) #9

@senyor you’re a star, that’s exactly what I needed!!!

(Romarius75) #10

@senyor THX! Was about 6 hours of research and finaly here is the solution.

Does anybody know where the ./ path is located in docker toolbox virtual machine (boot2docker)?

i think so it would be possible to set up the docker-compose.yml file for both enviroments. standalone and docker toolbox.