Search code examples
windowsdockermountboot2dockermingw-w64

Docker mounts empty directories on containers


I'm running Docker Toolbox on Windows 10 Home with no Hyper-v, It is using Virtualbox.

Docker launches from Mingew like shell (boot2docker) and can see and use Windows directories.

The directory I'm trying to mount is D:\project\src

I tried:

$ cd /d/project
$ docker run -it -v "$PWD":/proj -w /proj golang
root@68ce305398a1:/proj# ls -a
. ..

And interestingly, if I do:

$ docker run -it -v "$PWD"/src:/proj -w /proj golang
root@68ce305398a1:/proj# ls -a
. ..

and then

$ docker run -it -v "$PWD":/proj -w /proj golang
root@68ce305398a1:/proj# ls -a
src . ..

Now src appears because I mounted it before, but not other directories under or besides src!

Although I have files in both D:\proj\ and D:\proj\src which are visible from that shell (boot2docker)

I also added that directory to virtualbox shared folders (though couldn't mount them).

What am I doing wrong? is there a way to get this to work on this environment?


Solution

  • Found the solution:

    The directory was incorrectly shared in Virtualbox.

    in boot2docker shell, I found that I have /d/proj which mounts empty in the container.

    But there is also /proj which is the incorrect share I have in virtual box.

    Just adding /d/proj as mount point in virtualbox sharing solved the problem.