-
-
Notifications
You must be signed in to change notification settings - Fork 0
Use cases
You have a Docker volume that you want to backup, but you can't/won't add the docker-backup image to that compose file.
Create a new docker-compose.yml
file and reference the volume using external: true
.
version: '3'
services:
backup:
image: niclaslindstedt/docker-backup:latest
volumes:
- nginx-config:/volumes/nginx-config
- /mnt/data/backups:/backup
- /mnt/nas/backups:/lts
volumes:
nginx-config:
external: true
The backup container will then create backups of the nginx-volume
according to the cron schedule and place them in the /mnt/data/backups
folder. The backups will then be copied (and pruned) for long-term storage to /mnt/nas/backups
.
You have files inside a Docker container that you would like to backup.
You will first need to create a Docker volume and mount it to that container.
In the (stripped-down) example below, we add a volume called nginx-config
inside /etc/nginx
.
version: '3'
services:
nginx:
image: nginx:latest
volumes:
- nginx-config:/etc/nginx
backup:
image: niclaslindstedt/docker-backup:latest
volumes:
- nginx-config:/volumes/nginx-config
- /mnt/data/backups:/backup
- /mnt/nas/backups:/lts
volumes:
nginx-config:
The backup container will then create backups of the nginx-volume
according to the cron schedule and place them in the /mnt/data/backups
folder. The backups will then be copied (and pruned) for long-term storage to /mnt/nas/backups
.
You have files on your host computer that you wish to backup.
Create a new docker-compose.yml
file and mount the host folder into the backup container.
version: '3'
services:
backup:
image: niclaslindstedt/docker-backup:latest
volumes:
- /home/niclas/Documents:/volumes/my-documents
- /mnt/data/backups:/backup
- /mnt/nas/backups:/lts
The backup container will then create backups of the /home/niclas/Documents
folder according to the cron schedule and place them in the /mnt/data/backups
folder. The backups will then be copied (and pruned) for long-term storage to /mnt/nas/backups
.