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

0
3
Asked By CuriousCat99 On

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.

3 Answers

Answered By TechyTim92 On

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.

Answered By DockerDude45 On

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.

Answered By NiftyNerd88 On

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.

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.