How to back up Mattermost in Docker (2026)
To back up Mattermost in Docker you cannot just dump the database — you also need the app's data volumes and its config. Dockstash dumps its PostgreSQL and MySQL databases consistently, captures the 2 volumes of on-disk data, and snapshots docker-compose.yml plus .env in one encrypted run.
What Mattermost stores
| Compose services | mattermost, postgres |
|---|---|
| Databases detected | postgres, mysql |
| Data volumes | mattermost_data (/mattermost/data), db_data (/var/lib/postgresql/data) |
| Config paths | docker-compose.yml, .env, config/config.json |
The backup plan
- Dump the PostgreSQL database. Run pg_dumpall -U "$POSTGRES_USER" to capture channels, posts, users, and team metadata consistently.
- Capture the data directory. Restic the /mattermost/data volume, which holds file attachments and uploaded images referenced by posts in the database.
- Capture compose, .env, and config.json. Restic docker-compose.yml, .env, and config/config.json which contains the AtRestEncryptKey and SQL settings needed on restore.
Restoring Mattermost
Posts and metadata are in Postgres while file attachments are under /mattermost/data — restore both so attachments resolve. Preserve config.json (AtRestEncryptKey) or encrypted fields cannot be read.
Back up Mattermost in one click All guides
Last updated: July 2026
Related database guides
Frequently asked questions
Are Mattermost file attachments in the database?
No. The database holds messages, channels, and users; uploaded files and images live under /mattermost/data. Both are required for a full restore.
Which database does Mattermost use?
PostgreSQL is recommended; MySQL is also supported. Dockstash detects the backend and dumps it consistently for that engine.
Why back up config.json?
It holds the AtRestEncryptKey and SQL/connection settings. Without the matching key, encrypted fields in the restored database are unreadable.