I installed the Docker Toolbox on my Windows 10 home machine. When I hit the quickstart icon, I get a bash shell, and I can run a command like
> docker run -it ruby /bin/bash
That puts me into the bash shell of the docker Ruby container. That container is running on a VirtualBox VM created by the Docker Toolbox. The VM had a shared folder setting with:
Folder Path: \\?\C:\Users
Folder Name: c/Users
read-only: unchecked
auto mount: checked
make permanent: checked
I would like to be able to access the C:\Users\ folder on my Windows 10 host from my docker container via a directory called /code within the container (which is running Debian Jessie).
How can I configure my VM, or my Docker container to be able to access that folder from my docker container?
The key was figuring out how to express the shared volume which traversed the Windows-VirtualBox boundary, and the VirtualBox-Docker boundary.
Since the shared folder between the VirtualBox VM and Windows 10 home is C:\Users, the mount must be somewhere under that folder tree.
The other key point is that the volume mount must start with "//". So the full docker command is:
docker run -it -v //c/Users/Jay/MyApp:/c/MyApp ruby /bin/bash
I can edit the file called C:\Users\Jay\MyApp\test.rb in Windows, using a nice text editor, and then run it in my Ruby Linux container as
root@ad1e3223e3c7:/# cd c/MyApp
root@ad1e3223e3c7:/c/MyApp# ruby test.rb
The output of test.rb appears on the console of the Docker container.