Windows Host, Linux Container using WSL2 and Network Drive

Hi All

I am hoping someone can help me, I have used Docker for awhile on a RaspberryPI and Synology so I understand the basics (very basics) but I am really struggling to get it working on my Windows device for when I want to test something!

I have currently installed Docker Desktop for Windows (Docker Desktop 4.10.1 (82475)) which is using WSL 2 Debian for the containers.

All my configs and files are saved on a network drive lets say \192.44.0.100 and then in various shared folders sitting under this drive.

These are mapped in Windows as Network drives m:\ n:\ etc I want to mount these as volumes so I can use them in containers I am testing/running on the Windows device.

I can’t get them to be used when in the compose I use z/folder:/folder etc
I then tried
\192.44.0.100\folder:/folder
again never worked.

Finally I tried both CIFS and NFS mounts of the volume.

docker volume create --driver local --opt type=cifs --opt o=username=USERNAME,password=PASSWORD,uid=UID,gid=GID,vers=3.0 --opt device=//192.44.0.100/folder folder

docker volume create --driver local --opt type=nfs --opt o=nfsvers=4,addr=192.44.0.100,rw --opt device=:/folder folder

all work as in it creates a volume but when I navigate to \wsl.localhost\docker-desktop-data\version-pack-data\community\docker\volumes on my windows device and select the folder there are no files shown.

Username and Password are correct I have tried both with and without the GUID info but the issue remains.

Does anyone know what I am doing wrong please? and how I can mount a network drive for use as a volume?

Thanks

A vollume baked by cifs/nfs will mount the remote share when a container is starting to use it and will be unmounted when the container is stopped. It will not be pre-mounted or held mounted when no container uses it.

Sorry I am not sure I understand. The volumes have been mounted and I applied them to the container using the volume mount but it says “refers to undefined volume” when starting

I would have expected that the volume showed the contents of the folder when setup so I can access the files on the shared drive as it is there is no data showing in these folders so the container thinks its a fresh install!

Thanks

EDIT: Never mind fixed it thanks

For future readers, can you please share how you fixed it?