Simple docker volume backup to S3.
Create tar.gz file from docker volume and upload it to S3.
This image is only for backup. It doesn't have any restore functionality.
Dockerhub: https://hub.docker.com/r/adamkoro/docker-volume-backup
- latest: Latest builded image
- Commit hashes: If you need you can use specific image via commit hash
- Tags: These are the version of the script
Variable | Description | Default |
---|---|---|
S3_BUCKET |
S3 bucket name | backup |
S3_ENDPOINT |
S3 endpoint | empty |
S3_ACCESS_KEY |
S3 access key | empty |
S3_SECRET_KEY |
S3 secret key | empty |
S3_REGION |
S3 region | empty |
S3_SSL |
S3 ssl usage | true |
BACKUP_NAME |
Name of the tar.gz file | backup |
NUMBER_OF_BACKUPS |
Number of the files in keep | 2 |
IMPORTANT: You need to mount volume with backup files to /backup
directory. Make sure mounted read-only
mode.
Backup file name: BACKUP_NAME_YYYY-MM-DD-HH-MM-SS.tar.gz
that's why you have to set BACKUP_NAME
environment variable.
docker run --rm -it -v /backup/:/backup -e S3_BUCKET=backup -e S3_ENDPOINT=minio.server.local -e S3_ACCESS_KEY=test -e S3_SECRET_KEY=test -e S3_REGION=home -e S3_SSL=true -e BACKUP_NAME=test-backup docker.io/adamkoro/docker-volume-backup:latest
version: '3.7'
services:
backup:
image: docker.io/adamkoro/docker-volume-backup:latest
volumes:
- docker-tmp-backup/:/backup:ro
environment:
- S3_BUCKET=backup
- S3_ENDPOINT=minio.server.local
- S3_ACCESS_KEY=test
- S3_SECRET_KEY=test
- S3_REGION=home
- S3_SSL=true
- BACKUP_NAME=backup
volumes:
docker-tmp-backup: