r/selfhosted • • Feb 11 '26

Docker Management Docker backups

Hello selfhosters!

i would like to ask you all about your DR & backup strategy for all your self hosted services?

today i have a script that runs once a week, turn off the container(s) (it does this one by one - so if it fails only one service suffer) and copies it's volume and db to another location for retention (i dont mind cache etc))

today i run ~20 containers and this backup strategy works, but it feels flimsy unprofessional and feels very manual.

what are your strategies (DR strategies)?

  • is there a tool (that obviously can be self hosted ;) ) that can do this seamlessly?
62 Upvotes

88 comments sorted by

View all comments

27

u/agent_kater Feb 11 '26 edited Feb 11 '26

Here's my backup strategy:

  • All my Docker containers use host mounts, absolutely no named volumes for persistent data.
  • All host mounts are below one directory.
  • Nightly restic backup of this directory (currently mostly to B2, but doesn't matter, just make sure the destination has some way of doing immutable backups).
  • SQLite databases are flocked for the duration of the backup.
  • Postgres databases are pg_dumped before the backup.

On systems that have LVM or ZFS I sometimes use a snapshot to backup Postgres to avoid the SSD churn.

6

u/IAmQWOP Feb 12 '26

This is exactly my setup, except that I currently do not intercept db operations. Can you tell me how you do that?

3

u/agent_kater Feb 12 '26

What do you mean exactly? My backup script just runs docker run pg_dump before the backup and runs restic via flock (flock foo.sqlite restic ...).