A docker image to periodically backup directories.
- Quick start
- Beginner Guide
- Environment Variables
- Advanced User Guide
# Run Backup Manager image docker run --volume /host/data:/data/input --volume /host/backup:/data/backup --detach osixia/backup:0.2.1
Backup directory and data persistence
Backups are created by default in the directory
/data/backup that has been declared as a volume, so your backup files are saved outside the container in a data volume.
For more information about docker data volume, please refer to :
The container default log level is info.
Available levels are:
Example command to run the container in
docker run --detach osixia/backup:0.2.1 --loglevel debug
See all command line options:
docker run osixia/backup:0.2.1 --help
Environment variables defaults are set in image/environment/default.yaml
See how to set your own environment variables
BACKUP_INPUT: Directory to backup. Defaults to
BACKUP_OUTPUT: Directorie to save backups in. Defaults to
BACKUP_CRON_EXP: Cron expression to schedule backup execution. Defaults to
0 4 * * *. Every days at 4am.
BACKUP_TTL: Backup TTL in days. Defaults to
Set your own environment variables
Use command line argument
Environment variables can be set by adding the --env argument in the command line, for example:
docker run --env BACKUP_CRON_EXP="0 1 * * *" \ --detach osixia/backup:0.2.1
Link environment file
For example if your environment file is in : /data/backup/environment/my-env.yaml
docker run --volume /data/backup/environment/my-env.yaml:/container/environment/01-custom/env.yaml \ --detach osixia/backup:0.2.1
Take care to link your environment file to
/container/environment/XX-somedir (with XX < 99 so they will be processed before default environment files) and not directly to
/container/environment because this directory contains predefined baseimage environment files to fix container environment (INITRD, LANG, LANGUAGE and LC_CTYPE).
Make your own image or extend this image
This is the best solution if you have a private registry. Please refer to the Advanced User Guide just below.
Advanced User Guide
Extend osixia/backup:0.2.1 image
If you need to add your custom TLS certificate, bootstrap config or environment files the easiest way is to extends this image.
FROM osixia/backup:0.2.1 MAINTAINER Your Name <firstname.lastname@example.org> ADD environment /container/environment/01-custom
Make your own backup image
Clone this project :
git clone https://github.com/osixia/docker-backup cd docker-backup
Adapt Makefile, set your image NAME and VERSION, for example :
NAME = osixia/backup VERSION = 0.2.0 becomes : NAME = billy-the-king/backup VERSION = 0.2.0
Add your custom keys, environment files, config ...
Build your image :
Run your image :
docker run -d billy-the-king/backup:0.2.1
We use Bats (Bash Automated Testing System) to test this image:
Install Bats, and in this project directory run :
Under the hood: osixia/light-baseimage
This image is based on osixia/light-baseimage. More info: https://github.com/osixia/docker-light-baseimage
Please refer to: CHANGELOG.md