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 PocketBase stores
| Compose services | pocketbase |
|---|---|
| Databases detected | sqlite |
| Data volumes | pb_data (/pb/pb_data) |
| Config paths | docker-compose.yml, .env |
The backup plan
- 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.
- 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.
- 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.