Backup & Rollback
Automatic image backup before updates and one-click rollback to any previous version.
How It Works
Before every container update, drydock automatically backs up the current image metadata including the image name, tag, digest, and timestamp. This ensures you always have a record of exactly which image was running prior to each update.
Backups are stored in the LokiJS data store, which is persisted to the /store volume. Each container retains its N most recent backups, with older entries pruned automatically when the limit is exceeded.
Backup Retention
The number of backups retained per container is configurable via a trigger environment variable.
| Env var | Required | Description | Supported values | Default value when missing |
|---|---|---|---|---|
DD_TRIGGER_DOCKER_{trigger_name}_BACKUPCOUNT | ⚪ | Number of backups to retain per container | integer | 3 |
Manual Rollback
Rollback is available in two ways:
- UI -- on the container detail page, select a previous backup and click Rollback.
- API -- send a
POSTrequest to/api/backup/:id/rollback, where:idis the container ID.
When a rollback is triggered, drydock will:
- Pull the backup image
- Stop the current container
- Recreate the container using the backup image
- Start the new container
You can optionally pass a backupId in the request body to target a specific backup. If omitted, the most recent backup is used.
# Roll back to the most recent backup
curl -X POST http://localhost:3000/api/backup/my-container-id/rollback
# Roll back to a specific backup
curl -X POST http://localhost:3000/api/backup/my-container-id/rollback \
-H "Content-Type: application/json" \
-d '{"backupId": "abc123"}'Auto-Rollback on Health Failure
Containers with a Docker HEALTHCHECK can automatically roll back if they become unhealthy after an update.
Container Labels
| Label | Type | Default | Description |
|---|---|---|---|
dd.rollback.auto | boolean | false | Enable auto-rollback when health check fails after update |
dd.rollback.window | number (ms) | 300000 | Duration to monitor health after update (5 minutes) |
dd.rollback.interval | number (ms) | 10000 | Frequency of health status checks (10 seconds) |
How It Works
- An update completes successfully
- If
dd.rollback.auto=trueand the container has aHEALTHCHECK, monitoring starts - Health status is polled every
dd.rollback.intervalfor the duration ofdd.rollback.window - If the status becomes
unhealthy, rollback is triggered automatically - If the window expires without failure, the container is considered stable
HEALTHCHECK instruction in your Dockerfile. Without one, monitoring is skipped.Examples
services:
myapp:
image: myapp:latest
labels:
- dd.rollback.auto=true
- dd.rollback.window=600000
- dd.rollback.interval=5000
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 3docker run \
--label "dd.rollback.auto=true" \
--label "dd.rollback.window=600000" \
--label "dd.rollback.interval=5000" \
--health-cmd "curl -f http://localhost:8080/health" \
--health-interval 10s \
--health-timeout 5s \
--health-retries 3 \
myapp:latest