How to back up PocketBase in Docker (2026)

PocketBase spreads its state across its SQLite database and 1 data volume on disk, plus compose and .env config. A backup that skips any layer will not restore cleanly. Dockstash auto-detects each layer, dumps the database from inside the container, and stores the lot off-site with restic.

What it stores

What PocketBase stores

Compose servicespocketbase
Databases detectedsqlite
Data volumespb_data (/pb/pb_data)
Config pathsdocker-compose.yml, .env
Step by step

The backup plan

  1. Back up the SQLite database consistently. Use sqlite3 ".backup" (or PocketBase’s built-in backup) on pb_data/data.db through the online backup API — never copy the live .db under WAL.
  2. Capture the pb_data storage. Restic the pb_data directory, which holds the database plus uploaded file storage under pb_data/storage. Both live in one volume.
  3. Capture compose config. Restic docker-compose.yml and .env so environment settings and the deployment shape are preserved.

Restoring PocketBase

PocketBase keeps its SQLite database and uploaded files together under pb_data. Use the online backup API or PocketBase’s built-in backup, then restore the whole pb_data directory with the app stopped to avoid WAL races.

Back up PocketBase in one click All guides

Last updated: July 2026

Related database guides

Frequently asked questions

Can I just copy pb_data to back up PocketBase?

Not while it is running — the SQLite database uses WAL, so a live copy can be torn. Use sqlite3 ".backup" or PocketBase’s built-in backup for the database, then capture the storage subdirectory.

Is everything PocketBase needs in one directory?

Yes. pb_data holds both the SQLite database and uploaded file storage. Back up the whole directory (with a consistent DB snapshot) for a complete restore.

Does PocketBase have a built-in backup?

Yes, it can create a consistent backup archive of pb_data. Dockstash can invoke it or use the SQLite online backup API directly, then restic the result off-site.