Skip to content

Volume snapshots

The volume strategy runs:

docker exec <container> tar -czf - <paths...>

against the paths configured on the backup config. Tar strips leading / so the archive contents are relative (e.g. var/lib/postgresql/data/...). Restore extracts with tar -xzf - -C /, which recreates the absolute paths.

Each path must be absolute and written in plain form: no //, . or .. parts, and not / on its own. A trailing / is accepted (/data and /data/ both work). Control characters and path parts starting with - are refused.

Filename format: {containerName}-{YYYYMMDD-HHMMSS}.tar.gz

Backing up a live postgres data directory produces a crash-consistent snapshot, but a volume restore over the same directory is racy because pg keeps files open. Use the dedicated DB strategy (postgres/mysql/mongo/redis) that speaks the protocol. Stop/start hooks cannot help here: the volume backup and restore run tar inside the service’s own container, so that service must stay running. Hooks can stop other services that write to the data (see Backup hooks).

services:
app:
image: myapp:latest
volumes:
- uploads:/var/uploads
labels:
simpledeploy.backup.strategy: "volume"
simpledeploy.backup.schedule: "0 3 * * *"
simpledeploy.backup.target: "s3"
simpledeploy.backup.retention: "30"

Then in the backup config, set paths: ["/var/uploads"].

See also: Backups overview, Restore.