Backing up volume data to Amazon S3 bucket.
Build a docker image from Dockerfile.
docker build -t seginus/docker-s3-backup .
Run docker-s3-backup with setting environment variables and linking volumes.
Example:
docker run -it -d \
--volumes-from docker-mongodb-data \
--name docker-s3-backup-mongodb \
-e "AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxxxx" \
-e "AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-e "S3_BUCKET=seginus-backup" \
-e "S3_DIR=backup" \
-e "AWS_REGION=ap-northeast-1" \
-e "BACKUP_TARGET=/var/lib/mongodb" \
-e "CRON_MINUTE=30" \
-e "CRON_HOUR=10" \
seginus/docker-s3-backup
These variables are required to set up docker-s3-backup.
AWS_ACCESS_KEY_ID
: AWS access key IDAWS_SECRET_ACCESS_KEY
: AWS secret access keyS3_BUCKET
: Bucket nameS3_DIR
: Bucket folder nameAWS_REGION
: AWS regionBACKUP_TARGET
: Backup target file or directory
These cron variables are optional. The default value is *
.
CRON_MINUTES
: Specify between 0-59CRON_HOUR
: Specify between 0-23CRON_DAY
: Specify between 1-31CRON_MONTH
: Specify between 1-12 or nameCRON_WEEK
: Specify between 0-7 or name
You can also define max backup count.
MAX_BACKUPS
: The default value is20