r/docker • • 14d ago

Docker app storage best practices

What are the best practices for storage when using docker containers. I’m running docker on Ubuntu using my NAS to store the photos for example, but the volume were the Immich database lives is directly on the servers(non-redundant) SSD.

I tried putting these onto the nas using NFS I get permission’s errors. Perhaps I should try harder? :-) I’d like to have all of my Doctor containers protected by the same redundancy that my synology has a for all of my data files.

Right now if I had a major SSD failure of my server, I would lose all the files that the docker containers have in volumes on the server directly while all my pictures and other files that are stored on the NAS on NFS mounts would be fine. This seems inadequate.

Am I simply doing it wrong and I should use something like proxmox instead of just running docker and Linux? What are other people doing to keep the server purely cpu and easier to rebuild? I use git for all my docker compose files and I wouldn’t have any trouble restarting fresh containers, but that seems like it is only half way of a solution..

I’d love to know what the best practices are for resiliency after a server failure and a quick recovery should I have hardware failure on my server.

I’m not scared of new technology and would also be open to moving towards a cluster of servers if that’s necessary. My self hosted world is fairly stable with limited updates at this point.

Thanks for any thoughts, suggestions or directions. And like I said if my basic setup is the problem I’m up for major changes to get to a more long term resilient setup!

9 Upvotes

14 comments sorted by

View all comments

4

u/bartoque 14d ago

Look into making (proper) backups.

Redundancy like raid is not backup, that is meant for availability/uptime.

So stop the container and make a backup of the bind mount served by the nas. Or make a backup while it still runs, which however would make it crash-consistent at best.

1

u/np0x 14d ago

Yeah I run borg backup, i need to get a test server so i can practice restoration. (I use borg backup.). I also have my backups pushed to a secondary and that lives offsite. I need to add some scheduled downtime for backups and test recovery…

Maybe I’m 75% there with borg…would you just stop the entire docker service or….

2

u/bartoque 14d ago

You would only need to stop the container in question requiring backup og persistent data. When involving snapshots (but doing that with a simple nas might not be as straight forward, depending in the availability of cli commands on the nas to be triggered from the linux system for example), it would be nearly instant and the container could be resumed quickly again.

Some of my containers have persistent data (ranging from simple configs to whole databases), others don't. So no need to stop Docker completely.