Absolute Linux Paths with Docker Desktop for Windows

Where does Docker Desktop for Windows mount a volume that is specified by an absolute unix path?
e.g.
In my docker-compose file I have the following:
volumes:

  • /projects-data/:/data/
    For some odd reason this does seem to work but I have no idea where this /projects-data/ folder is supposed to be. I can’t find it on my host or withing WSL.
    Any ideas?

It will create a folder inside the WSL distribution, but you will not find it when you list the files in the WSL distribution, since the Docker daemon is running in a container.

  • Docker Desktop creates a VM
  • Docker Desktop creates containers inside the VM using containerd in the “services.linuxkit” namespace.
  • One of those containers is “docker” which runs the Docker daemon
  • In that containerd container you could find “/projects-data”, but this is a temporary folder on the containers filesystem, so I don’t recommend using it

If you want to create projects-data in the root of your drive on Windows, use

volumes:
  - C:/projects-data:/data

If you prefer the Windows way, this should work too

volumes:
  - C:\\projects-data:/data

Replace C: with the drive letter you want to use.