I'm transitioning from Windows to Linux Mint and diving into Docker for setting up a media server, photo server, etc. I've been using the host's fstab to mount my NAS network drives to /mnt/data/ and then bind mounts in my Docker Compose files to access these drives. However, I've heard that if Docker starts before my NAS is available, it will create a local folder instead, which worries me. I've read about various workarounds, but the CIFS volume driver seems to be the most straightforward solution as it can handle the connection itself. This makes me nervous, though, because I've seen warnings that removing a volume will delete data within it. I want to ensure I don't lose access to my files if I ever stop using Docker. Can someone clarify the differences between using a CIFS volume driver and host mounting with bind mounts? Which option would be safer for keeping my files?
3 Answers
The main difference lies in how you manage your volumes. If you use host mounting, moving to a different server later would require you to set up the volumes manually on the new host. With a CIFS volume driver directly in your container, you won’t have to deal with host configurations, which makes it a lot easier for future migrations.
Your concerns about volumes are common, especially with local volumes. The good news is that when you're using the CIFS volume driver, it acts as a client to your NAS, meaning if you remove the volume, it only cuts off access, but the data on your remote server remains intact.
I get what you're saying. With the fstab approach, managing files between your host and the NAS is super easy, especially if something goes wrong with your applications. As for defining volumes, it is possible to define them globally, but you would need to reference them in every Docker Compose file unless you set them as external using the appropriate Docker documentation.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures