How to Mount a Network Shared Drive in a Docker Container on Windows?

March 30, 2026 3 answers
Asked by rgba8_mode
I'm trying to mount a folder from my NAS in a Docker container so I can store and view documents generated by my web app. I'm using Windows and have been struggling with this for a few days. I managed to map the folder to drive Z: and then set it up to mount to /mnt/shared in my docker-compose file, but when I run 'ls /mnt/shared', it's empty. The NAS has FTP enabled, but I'm not sure what else to check since I'm still new to Docker.

Answers

2bit grayscale
Instead of mapping a Windows drive to the NAS, try mounting the NAS partition directly as NFS in your Docker container. This will simplify things and should show the data in Z: on your Windows machine. Just keep in mind that if your NAS requires credentials, NFS might complicate this since it typically doesn't handle credentials well.
Reply to this answer
margin+notes
Since Docker Desktop runs on a virtual machine, you'll need to check the file paths in your file explorer. Make sure the path starts with a forward slash ('/'). Alternatively, you might want to consider directly mounting the NAS partition using NFS in your Docker container to bypass any issues with the Windows file system overlay.
Reply to this answer
bike lane advocate
I haven't tried this on Windows, only on Linux, but it sounds like you're on the right track. Make sure you mount the remote share properly and create a volume bind in your docker-compose file. You might want to create a test file, like 'testshare.txt', in that folder to see if it's actually writing to itโ€”it could be a path issue.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions