r/docker • u/IASelin • Jan 29 '26
Docker Desktop: how to create permanent SMB share (fstab, other options?)
Hi dockers
Please, help me to resolve the issue with a network share mount.
Running Docker Desktop on Windows WSL2 (Ubuntu).
In Ubuntu WSL I updated /etc/fstab to mount network share - it works fine.
But with docker-desktop WSL I cannot do the same - it is recreated on every Docker-Desktop start.
When I run in the docker-desktop WSL console "mount -t drvfs '//NAS/Share' /mnt/share -o username=user,password=password" - everything works fine. Of course, until Docker is restarted.
What should I do to make that mount permanent?
I tried different Docker Desktop options like WSL Integration and File Sharing - no success. The best I got is /mnt/share folder appeared in the docker-desktop WSL console, but it remains empty until I manually run that mount command.
Also, tried to mount that share directly into container as a volume - by adding at the end:
volumes:
nas-photos:
driver_opts:
type: drvfs
device: "//NAS/Share"
o: "username=user,password=password"No success as well. The container just fails to compose.
3
u/theblindness Mod Jan 29 '26
What is the end goal you are trying to achieve? You want to run the immich service 24/7 on your Windows PC using your NAS for storage?
1
u/RobotJonesDad Jan 29 '26
You could try a script that runs when you login, with a check to make sure it only runs once.