| title | Dokploy |
|---|---|
| description | Back up the Dokploy panel, its database, and your apps' Docker volumes. |
| icon | rocket |
Deploy with confidence, restore with even more.
On a Dokploy server nearly everything that matters lives in Docker: your apps, their volumes, and Dokploy's own database. The whole-server job deliberately skips /var/lib/docker, so on its own it backs up the OS and none of your apps. Add the two jobs below next to it.
Dokploy keeps its configuration under /etc/dokploy (applications, compose files, Traefik config and certificates, SSH keys) and its state in a Postgres service called dokploy-postgres. This job dumps that database from inside its container, the same way Dokploy's own web-server backup does, and archives both. No password is needed: the dump connects through the container's local socket.
- name: dokploy
sources: [/etc/dokploy]
exclude:
- /etc/dokploy/volume-backups
- /etc/dokploy/logs
databases:
- name: dokploy
type: postgres
container: dokploy-postgres
user: dokploy
database: dokploy
destinations: [offsite]
schedule: "0 3 * * *"
encryption:
passphrase: ${BACKUP_PASSPHRASE}
retention: { keep_last: 14 }Named volumes hold your apps' data (uploads, files, and the data directories of databases you created in Dokploy).
- name: dokploy-volumes
sources: [/var/lib/docker/volumes]
exclude:
- /var/lib/docker/volumes/dokploy-postgres
- /var/lib/docker/volumes/backingFsBlockDev
destinations: [offsite]
schedule: "30 3 * * *"
encryption:
passphrase: ${BACKUP_PASSPHRASE}
retention: { keep_last: 7, keep_days: 30 }To see what's in there and how big each volume is:
docker volume ls
du -sh /var/lib/docker/volumes/* | sort -hVolumes are copied while the containers run. That's fine for files, but a database's raw data directory can be caught mid-write. Dump each database you created in Dokploy instead, using the App Name from its Dokploy page as the container. Dokploy runs it as a Swarm service, and NoBackups matches the <app-name>.1.xyz container automatically.
- name: dokploy-databases
databases:
- type: postgres
container: myapp-postgres-k1x2y3 # the database's App Name in Dokploy
user: myapp # its Database User in Dokploy
password: ${MYAPP_DB_PASSWORD}
- type: mariadb
container: blog-mariadb-a9b8c7
password: ${BLOG_DB_ROOT_PASSWORD}
destinations: [offsite]
schedule: "0 */6 * * *"
encryption:
passphrase: ${BACKUP_PASSPHRASE}
retention: { keep_last: 28 }Then add those databases' volumes to the dokploy-volumes job's exclude. The credentials are on each database's page in Dokploy.
```bash
nobackups restore dokploy-volumes --target / --path var/lib/docker/volumes/<volume-name>
```
Start the app again in Dokploy.