- Build Docker environment on Windows 10 HOME with Docker Toolbox
- Tried everything conceivable with
-vsuch as//c/docker,/c/docker,C:/docker, but none worked. - Found that to make it work, you need to preset mount directories in Docker GUI settings
- But it doesn't exist. Apparently that settings screen is specific to "Docker for Windows".
- So there are two options: "Search for a way to mount with Docker Toolbox" or "Try with Docker for Windows"
- After researching various things, resolved.
Conclusion
With “Docker Toolbox”, you can only mount directories under //c/Users/.
This means referencing folders directly under the C drive like “/c/docker” with -v won’t work.
However, with the above method the volume exists and it feels somewhat successful, which adds to the confusion.
Understanding was faster after knowing the clear difference between “Docker for Windows” and “Docker Toolbox”.
- Verification
# Check while looking at host folder
$ docker run --rm -it -v //c/Users/$USERNAME/src:/docker ubuntu touch /docker/hoge.md
# Verify by entering Container
$ docker run --rm -it -v //c/Users/$USERNAME/src:/docker ubuntu
root@7b5fd1210a2c:/# ls /docker
fuga.md hoge.md new.txt
root@7b5fd1210a2c:/# rm /docker/*
root@7b5fd1210a2c:/# # create a file on host.
root@7b5fd1210a2c:/# ls /docker
new.txt
root@7b5fd1210a2c:/#
In Case of Docker for Windows
You need to preset mount directories in Docker GUI settings https://rominirani.com/docker-on-windows-mounting-host-directories-d96f3f056a2c
References
- https://forums.docker.com/t/volume-mounts-in-windows-does-not-work/10693
- https://rominirani.com/docker-on-windows-mounting-host-directories-d96f3f056a2c
- https://forums.docker.com/t/docker-data-volumes-and-windows-mounts/31499/2