When working with Docker-Toolbox on Win7 or even on Win10 (for those without Hyper-VM), you'll notice that docker
dislikes any volume mounts that have any Windows paths. What you have to understand is that volume mounts work
within the Linux VM that then get projected on to the Docker container. So this means the following:
- NO to
C:\\path\in\windows:/src
- YES to
/path/in/linux:/src
where the/path/in/linux
can be a Shared Drive toC:\\path\in\windows\
provided by VMWare.
By default, a docker-machine will have C:\Users
shared and will exist as /c/Users
inside the Linux VM. So if
you want to volume mount your current working directory inside the container, you'll want to express it as:
# Assume working directory is C:\Users\bdangit\woof
docker run --volume /c/Users/bdangit/woof:/src someimage
If you want to use any other folder other than C:\Users
, you'll need to add additional Shared Folders to
your docker-machine VM which are provided below.
In the context of habitat, when you run this command: hab studio enter
, it tries to volume mount C:\hab\cache\keys
and
C:\hab\cache\artifacts
. If you translate these to what they must run as, they should be /c/hab/cache/keys
and
/c/hab/cache/artifacts
, respectively. Of course if you ever look inside your docker-machine, ls /c/hab
will not exist.
So at a minimum you will want to add C:\hab
as a Shared Folder.
- On VMWare Workstation, locate the docker-machine. If you created a docker-machine called "dev", you should find a VM called "dev".
- Right click the machine and click Settings.
- Navigate to the Options tab and select the Shared Folders.
- Click Add.. and set the following parameters:
Host path: c:\hab
Name: hab
- Click Next.
- (Optional), if you need more now is the time to do it.
- Restart the VM.
- On command line,
docker-machine ssh <docker-machine_name> sudo ln -s /mnt/hgfs/hab /c/hab
- (Optional), repeat the above command if you have more Shared Folders.
- Now you are ready to rock out
hab studio
with a huge caveat, you'll need to volume mount the right folders:
# example
docker run --rm --tty --interactive --privileged --volume /c/Users/bdangit/habtest:/src \
--volume /c/hab/cache/keys:/hab/cache/keys --volume /c/hab/cache/artifacts:/hab/cache/artifacts \
--volume /var/run/docker.sock:/var/run/docker.sock habitat-docker-registry.bintray.io/studio:0.30.2 enter
- Provide an alias to do the above as a work-around
- Submit a PR to support both types of pathing in Win7/Win10withoutHyperVM