3

I am facing some weird problem, I suspect, I am missing something but not able to find what is wrong. I spent quite a bit of time but not able to find what the problem is.

I have windows 10 with wsl2 enabled. Installed Docker desktop with wsl2 as recommended by installer.

Now I want to share a folder on D drive into a container. In order to test that I created a sample ubuntu container using below compose file

services:
  test:
    image: ubuntu:plucky-20241213
    command: tail -F anything
    volumes:
      - /mnt/host/d/Data:/abcd 
    networks:
      - temp-net

networks: temp-net:

Even though Docker-desktop showing /abcd as mounted folder for that container. But it is not showing any folder/files that are available under D:\Data folder at /abcd

Created some file using Exec tab touch command, Now that file shows up in container Files tab, but it does not shows up on my windows D Drive folder.

Just to mention I can see files/folder under D:/Data folder if I connect to Docker-Desktop distro on windows command line using wsl.

I tried searching around web and stackoverflow. Found many post around the topic but not exactly any that having same issue.

Am I missing something fundamental here?

Giacomo1968
  • 58,727

1 Answers1

5

Able to work it out. Problem was I was using WSL distro created by docker-desktop installation.

I created a Ubuntu distro in WSL2 using wsl --install Ubuntu and linked that to docker desktop using wsl-integration option.

Now same the docker-compose file works fine if I start inside Ubuntu distro instead of docker-desktop distro. Here I used /mnt/d/Data location.

Giacomo1968
  • 58,727