mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-14 21:35:36 +02:00
Add label to optionally skip container restart after backup (#659)
* Add label to optionally skip container restart after backup * Add new mutually exclusive label instead * Simplified `hasLabel` * removed unnecessary else block * added new test-case `no-restart` based on test-case `local` * removed invalid README entry * added new section to how-tos * Added configuration reference
This commit is contained in:
@@ -34,3 +34,29 @@ services:
|
||||
volumes:
|
||||
data:
|
||||
```
|
||||
|
||||
## Stop containers during backup without restarting
|
||||
|
||||
Sometimes you might want to stop containers for the backup but not have them start again automatically, for example if they are normally started by an external process or scheduler.
|
||||
|
||||
For this use case, you can use the label `docker-volume-backup.stop-during-backup-no-restart`.
|
||||
This label is **mutually exclusive** with `docker-volume-backup.stop-during-backup` and performs the same stop operation but skips restarting the container after the backup has finished.
|
||||
|
||||
```yml
|
||||
services:
|
||||
app:
|
||||
# definition for app ...
|
||||
labels:
|
||||
- docker-volume-backup.stop-during-backup-no-restart=service2
|
||||
|
||||
backup:
|
||||
image: offen/docker-volume-backup:v2
|
||||
environment:
|
||||
BACKUP_STOP_DURING_BACKUP__NO_RESTART_LABEL: service2
|
||||
volumes:
|
||||
- data:/backup/my-app-backup:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
|
||||
volumes:
|
||||
data:
|
||||
```
|
||||
|
||||
@@ -539,6 +539,13 @@ The values for each key currently match its default.
|
||||
# you can override this default by specifying a different string value here.
|
||||
# BACKUP_STOP_DURING_BACKUP_LABEL="true"
|
||||
|
||||
# Containers or services can also be stopped for the duration of the backup
|
||||
# without being restarted afterwards by applying a
|
||||
# `docker-volume-backup.stop-during-backup-no-restart` label. This behaves the
|
||||
# same as `docker-volume-backup.stop-during-backup` but is mutually exclusive and
|
||||
# skips restarting the container or service once the backup has finished.
|
||||
# BACKUP_STOP_DURING_BACKUP_NO_RESTART_LABEL="true"
|
||||
|
||||
# When trying to scale down Docker Swarm services, give up after
|
||||
# the specified amount of time in case the service has not converged yet.
|
||||
# In case you need to adjust this timeout, supply a duration
|
||||
|
||||
Reference in New Issue
Block a user