I'm having trouble keeping a network share permanently mounted in Docker Desktop while running it on Windows with WSL2 (using Ubuntu). I've successfully updated my `/etc/fstab` in Ubuntu WSL to mount the share, but it doesn't retain the settings in the Docker-desktop WSL because it gets recreated each time Docker starts. I've managed to manually mount the share using the command `mount -t drvfs '//NAS/Share' /mnt/share -o username=user,password=password`, but I need it to be permanent since it resets on Docker restart. I've also tried Docker Desktop's file sharing options and directly mounting the share as a volume in my container, but that hasn't worked either. How can I achieve a permanent mount for my network share?
2 Answers
What exactly are you aiming to do? Are you trying to run the Immich service continuously on your Windows PC using the NAS storage?
Got it, that makes sense. You could try a startup script that runs on login to automatically handle the mount, but make sure it checks to see if it's already mounted first. It could save you some effort.
One option might be to create a script that executes every time you log in to ensure the share mounts automatically. It's not a perfect solution, but it should do the trick for you.
I’ll give that a shot! It feels more like a workaround than a solid fix, but if it works, that’s what matters. Thanks for the tip!
No problem! Sometimes a good workaround is better than dealing with constant issues.

Exactly! I want to run Immich and connect to that shared folder as an external library. Ideally, I'd prefer running Immich on my NAS, but since it's FreeBSD-based, there's no native Docker support. I tried running it with Podman, but that didn't work out either. So now, I'm on Docker Desktop on Windows, and while I can run Immich, I have to manually mount the network share every time I restart.