Docker Toolbox (a "Legacy" version which is the only Docker you can use if you have Windows 10 Home and not Professional) needs an environment variable set so that docker-compose
can adapt paths to Unix style, to be used in the volumes
property in a docker-compose.yml
file.
To do this, you can go to the Explorer, open "Properties" on "This PC" (right-click menu), then click on "Advanced system settings" (on the left sidebar), then on "Environment Variables" on the "Advanced" tab, and then creating a new variable named "COMPOSE_CONVERT_WINDOWS_PATHS" with a value of "1" (without quotes).
When installing Docker Toolbox, a bunch of environment variables are added. Why they don't just add this one, when their documentation clearly states that you should "always set this", is anyone's guess.
But, as things often are, this was not enough to make things work.
After reading this article, here's what I did: From the VirtualBox Manager interface, which Docker Toolbox uses, locate the oddly-named "default" VM and configure a "Shared Folder" on it (I have a "Repos" dir that I'll most likely always put my Docker stuff in, so I pointed it to the right place and named it that). Then, reset the VM (right-click on it and select "Reset"). Then, on my docker-compose.yml
file, I couldn't make a relative path work, so I added an "absolute" one (well, absolutely relative to my "Repos"), taking care to use backslashes instead of forward-slashes. In my case, it looks like this:
services:
my_container:
build: .
working_dir: /my_dir
volumes:
- \Repos\my_dir:/my_dir:rw
Awful. But it works.