Hey everyone! I've been working with Docker on my home server for a while now, and I want to dive a bit deeper into its functionality. Currently, I'm running several containers and, by default, they get stored on my NVME drive where my Fedora Server is installed (in /var/lib/docker). I have two SSD drives set up just for data storage, and I'm curious if I can change where Docker stores its containers and their associated volumes. Specifically, I'm looking to save them on /mnt/ssd1/docker instead.
Additionally, will there be any issues if I store containers and volumes on a drive different from the one where Docker is installed? Are there potential speed differences or any permission issues to watch out for? Thanks in advance for your help!
3 Answers
I recommend using bind mounts instead. It keeps things simple and you can manage your data directly without altering the Docker daemon settings. This way, you can easily specify where individual containers store their data—it might just be safer and easier in the long run!
You can definitely change the default storage location for Docker! Check out the Docker documentation for guidance on moving the data directory to a new location. Essentially, you can adjust the `data-root` setting to point to your desired folder. Just keep in mind that if you switch locations on an existing setup, your current containers and images might seem lost since they won't be found at the new path. It's often easier to do this with a fresh setup, or you can set up bind mounts for individual containers instead!
Thanks for sharing that! So to clarify, if I change the data location, I should be mindful to back up my containers first, right?
Storing containers and volumes on a different drive shouldn't cause issues as long as you set it up correctly. For Docker, it's just a path on your system, but new users often face permission issues. Just make sure the Docker user has access to the new storage location, and you should be good to go!

But configuring the daemon is also safe! I think both methods have their pros. What's the advantage of bind mounts specifically?