4

For a docker-compose project, i'm running into the dreaded speed issue of volume mounts from the Windows host system on WSL2. I'm therefore trying to transfer my files to the unix filesystem of WSL2 and mount them from there.

I've therefore:

  1. copied over the repository from C:/srv/repo using explorer to //wsl$/srv/repo
  2. instructed Docker Compose to volume mount /srv/repo:/var/www

but... the directory is coming up empty. Because mounting /mnt/host/c/srv/repo also does not work, I'm thinking that I somehow have to instruct docker-compose to use the unix filesystem. I can mount / and then get some kind of strange empty filesystem that resembled Unix but does not share files with the //wsl$/ filesystem. If I exec into the WSL, I can see the files sitting there ready to be volume shared.

One idea I had was using the WSL shell to launch the docker-compose stack from the WSL distro directly, but it does not appear to have any docker executable, only returning:

The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.
See https://docs.docker.com/docker-for-windows/wsl/ for details.

Any idea's what I'm overlooking? Any pointer is much appreciated!

T. Altena
  • 752
  • 4
  • 15
  • Are you potentially missing something in your "therefore ... 1. Copied over ..."? You say you copied over to `//wsl$/srv/repo`, but it should be `//wsl$//srv/repo`. I'm guessing that's just a typo, but want to double-check. Also, are you running `docker-compose` from WSL or from PowerShell? It *sounds* like you are doing it from WSL, but again, just want to double-check. – NotTheDr01ds Jun 18 '21 at 22:01
  • Hi @NotTheDr01ds, thanks for taking the time to reply. I indeed missed the distroname in the copy path, but that's included. I'm running docker-compose from PowerShell, as running it from WSL gives me the error above (Docker could not be found in this distro) – T. Altena Jun 19 '21 at 09:34
  • Ah, if you are running it from PowerShell, see if [this answer](https://stackoverflow.com/a/67525916/11810933) helps. I'm assuming the docker-compose form is going to be the same as plain-old-docker. – NotTheDr01ds Jun 19 '21 at 21:52
  • Thanks for pointing me that way - I would've never tried that, as it feels like passing a network share to a volume drive. I had to escape the dollar sign in docker-compose with another dollar, and then it errors out on: `failed with: can't access specified distro mount service: stat /run/guest-services/distro-services/docker-desktop.sock: no such file or directory` – T. Altena Jun 21 '21 at 09:36
  • 1
    Is it possible that you are pointing it to the `docker-desktop` WSL distribution? It needs to be pointing to your "normal" distribution, and that distribution needs to be "enabled" with Docker (see [this answer](https://stackoverflow.com/a/64373477/11810933)). – NotTheDr01ds Jun 21 '21 at 19:06

0 Answers0