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

0
3
Asked By CuriousCoder99 On

I have a folder on my NAS that I want to mount into a Docker container to save and access some documents generated by my web application. I'm using Windows and have been trying for a few days to get this set up. The closest I've come is mapping the NAS to drive Z: and attempting to mount it to /mnt/shared in my docker-compose file, but when I run 'ls /mnt/shared', it shows up empty. The NAS settings indicate that "allow FTP" is enabled. I'm still figuring things out with Docker, so I'd appreciate any guidance on what else I should check or try to get this working.

3 Answers

Answered By VirtualVoyager On

Docker Desktop runs on a VM, so you'd want to verify the path starts with / when checking in your file explorer. Alternatively, you could mount the shared folder directly to avoid any Windows path issues. There's a helpful guide in the Docker documentation about using volume drivers that might clarify things for you!

SeekingSolutions -

I attempted to follow the guide, but I encountered a daemon error indicating that the argument was invalid when trying to mount.

Answered By TechieTommy On

I haven't tried this on Windows, just on Linux, but you're on the right track. You should mount the remote share to your server first and then make a volume bind in your docker-compose file. As a test, you could create a file like "testshare.txt" in that folder and see where it appears on your system. Your paths might be incorrect, or you could be having write access issues.

Answered By NFSNinja On

Instead of mapping a Windows drive that connects to your NAS, consider mapping the NAS partition directly as NFS in your Docker container. This method allows you to bypass the Windows overlay. It will still show up in Windows as Z:, but accessing the data will be more straightforward.

SharedSuffering -

I would love to try this, but my NAS requires credentials for access. From what I've seen, NFS doesn’t seem to allow for that.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.