Guide

Back up a self-hosted Supabase (Docker): database and files

Self-hosting Supabase means owning its backups. What to back up on a Docker install (Postgres, the Storage volume, the secrets), the commands, and how to prove a restore works.

By Sascha Heyer · Last updated December 4, 2026

On the hosted platform, Supabase takes daily backups of paid projects and sells point-in-time recovery. On a self-hosted install, none of that exists. Supabase’s self-hosting docs list backups and disaster recovery as your responsibility. A self-hosted Supabase is a set of Docker containers; three things in it hold data you cannot recreate.

What to back up

WhatWhere (Docker setup)How
Postgres (your data, auth users, storage metadata)db service, data in volumes/db/datapg_dump, nightly
Storage filesvolumes/storage (file backend) or your S3 bucketrsync, restic or S3 sync
Secrets and config.env, docker-compose.ymla password manager or encrypted copy

Back up Postgres with pg_dump

Run pg_dump inside the database container: it is always the same version as the server, and you need no open port. From the docker directory of your install:

docker compose exec -T db pg_dump -U postgres -d postgres --no-owner --no-privileges \
  --exclude-schema=extensions --exclude-schema=graphql --exclude-schema=graphql_public \
  --exclude-schema=realtime --exclude-schema=_realtime --exclude-schema=supabase_functions \
  --exclude-schema=vault --exclude-schema=pgsodium --exclude-schema=pgsodium_masks \
  --exclude-schema=net --exclude-schema=cron --exclude-schema=_analytics \
  | gzip > supabase-db-$(date +%F).sql.gz

-T stops Docker from allocating a terminal, which would corrupt the binary stream. Leave auth and storage in: they hold your users and the file list. From another machine, go through Supavisor’s session port instead, with the tenant ID in the user name:

pg_dump 'postgres://postgres.<POOLER_TENANT_ID>:<POSTGRES_PASSWORD>@<your-domain>:5432/postgres' ...

Copying volumes/db/data while Postgres runs gives you a corrupt copy. A file-level copy is only safe with the database stopped, and only restores into the exact same Postgres version, so make the dump your main backup.

Back up the Storage files

With the default file backend, uploads sit on the host’s disk. Copy the folder to another machine or to object storage, for example with restic, which deduplicates and encrypts:

restic -r s3:https://<account-id>.r2.cloudflarestorage.com/supabase-files init      # once
restic -r s3:https://<account-id>.r2.cloudflarestorage.com/supabase-files backup ./volumes/storage
restic -r s3:https://<account-id>.r2.cloudflarestorage.com/supabase-files forget --keep-daily 14 --keep-weekly 8 --prune

If you configured Storage with an S3 backend instead, back up that bucket with S3 tools (versioning on the bucket is the cheapest insurance). Either way, take the files and the database dump at about the same time so storage.objects and the files agree.

Keep the secrets

The .env file holds POSTGRES_PASSWORD, JWT_SECRET, the anon and service role keys and the Vault encryption key. Lose the JWT secret and every issued token is invalid; lose the Vault key and secrets stored in Vault cannot be decrypted. Store a copy in a password manager, not next to the backups.

Schedule, rotate, move off the host

# crontab -e on the host
15 2 * * * cd /opt/supabase/docker && ./backup.sh >> /var/log/supabase-backup.log 2>&1

A backup on the same server dies with the server. Put the dump in object storage at another provider, keep a rotation (14 daily, 8 weekly is a good start), and alert when the job fails or the newest file is older than a day.

Prove it restores

Restore the newest dump into a scratch Postgres every week and compare row counts per table; the backup testing guide has the script. The free liferaft CLI does the count-and-restore in two commands against any Postgres connection string, self-hosted Supabase included: liferaft dump, then liferaft drill.

The hosted Liferaft service is built for Supabase’s hosted projects (it connects through the Supabase pooler and the Supabase API). If you run hosted and self-hosted side by side, the CLI and the hosted service make the same kind of copy, so one restore routine covers both.

Rather not run this yourself? Liferaft runs the dump every night through a read-only role, stores the copy outside Supabase, and restores it every week to count every row. Free for one Supabase project; Solo is $9 a month for five. Back up my Supabase project free

Frequently asked questions

Does self-hosted Supabase include backups?

No. Supabase’s self-hosting docs list backups and disaster recovery as your responsibility; managed backups and PITR are only on the hosted platform.

Can I just copy volumes/db/data?

Only with the database stopped, and only to restore into the exact same Postgres version. A pg_dump is portable, consistent while the database runs, and restores into any newer Postgres, so make that the main backup.

Where are Storage files in self-hosted Supabase?

With the default file backend, on the server’s file system through a bind mount, under volumes/storage in the docker directory. Back that folder up next to the database dump.

More guides

Compare Supabase backup tools