blog.pekhov.com
October 2026 dockerbackups

Consistent PostgreSQL Dumps from Compose Stacks

Archiving raw pgdata files while a container is running can easily produce a torn state unless WAL archiving is configured properly. For small self-hosted apps, a logical dump before the nightly archive job is simpler and safer.

docker exec -t app-postgres pg_dumpall -U postgres \
  | gzip -9 > /var/backups/postgres/dump-$(date +%F).sql.gz

Testing a restore into a disposable container once a month catches broken permissions and missing extensions long before an actual disk failure.

← Back to all notes