How to Connect Docker Containers to SMB Storage Efficiently?

0
17
Asked By TechyTurtle92 On

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

Answered By SlickSailor77 On

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.

Answered By HomeServerHero On

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.

Answered By GamerGuru33 On

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.

Answered By FileWizard24 On

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.

TechyTurtle92 -

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.

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.