I'm dipping my toes into Docker and Linux, so bear with me. I have my media files stored on an SMB NAS and I'm reworking my Docker setup to use YAML instead of Portainer. What's the best way to connect my Docker containers to the SMB storage? Any advice on this would be really helpful!
4 Answers
I personally connect the SMB on the host machine first, then pass that connection to the Docker container. In my compose file, I set it up like this:
volumes:
- /mnt/host_directory:/mnt/container_directory
That way, whatever SMB mount you have on the host will be accessible from the Docker container.
I create the SMB share right on the host and then use bind mounts in my Docker configuration. I find it works perfectly fine without using NFS:
/volume1/video:/video:rw
Then when you're in the container, you just reference it as /video.
You can either let your host manage the SMB mount and map that volume in your Docker setup, or you can use a Docker network plugin that handles the SMB connection for you.
If your NAS has NFS support, you might want to consider that option. NFS tends to be a bit more reliable for Docker containers running on Linux hosts compared to SMB mounts. Though, it might complicate things if your Windows machines need access since they typically don’t handle NFS well.

Yeah, that's the issue. I’d prefer using NFS since it seems better for Docker, but I need my Windows workstations to access the storage, and they're not compatible with NFS.