Backup files in your Docker containers, Docker volumes or host system folders.
2.6K
Backup your Docker volumes and/or data folders and store them both short-term and long-term. Prune unwanted backups according to precise pruning settings, or when free space gets tight.
CAUTION: Do not use this for production environments. It has not been thorougly tested yet.
Dockerfile linksv1, v1.2, v1.2.0, latestv1-docker, v1.2-docker, v1.2.0-docker, latest-dockerv1-alpine, v1.2-alpine, v1.2.0-alpine, latest-alpineThe tag versions might be outdated, but follow the SemVer specification and are updated on every new commit containing features or fixes to the running code.
-docker tagged images./volumes/backup/ltsSee the Use cases wiki page for more advanced use cases.
See the Frequently asked questions wiki page for a list of common questions.
Ask questions in the Discussions section if your question hasn't been answered in the FAQ.
| Variable | Default | Description |
|---|---|---|
ENABLE_LTS | true | Set to 'false' to disable long-term storage. |
ENABLE_PRUNE | true | Set to 'false' to disable purging of old backups. |
CRON_BACKUP | 0 5 * * * | Cron schedule for creating backups of all volumes. |
CRON_LTS | 0 9 * * * | Cron schedule for copying backups to the long-term storage folder. |
CRON_PRUNE | 0 3 * * * | Cron schedule for pruning backups. |
LOG_LEVEL | 2 | Set to a value between 0-5, where 5 is the most verbose. |
ARCHIVE_TYPE | tgz | Use this archive type for storage, one of: tgz zip rar 7z |
ENCRYPT_ARCHIVES | false | Encrypt archives after compressing them. |
ENCRYPTION_PASSPHRASE | Set a passphrase (symmetric key) to encrypt (and decrypt) files with. | |
ENCRYPTION_ALGORITHM | AES256 | The encryption algorithm used when encrypting backups, one of: IDEA CAST5 BLOWFISH AES256 TWOFISH CAMELLIA256. |
VERIFY_ENCRYPTION | false | Verifies that the encryption was successful by decrypting and verifying the sfv checksum. |
CREATE_CHECKSUMS | true | Set to 'false' to disable creation of checksums (sfv). |
VERIFY_CHECKSUMS | true | Set to 'false' to disable checksum (sfv) verification before restoring a backup and after copying a backup to long-term storage. |
CREATE_SIGNATURES | false | Set to 'true' to enable creating signatures of checksums. |
VERIFY_SIGNATURES | false | Set to 'true' to enable checksum signature verification. |
SIGNING_KEY | signing_key.asc | The name of the key that is either imported or generated on startup. |
SIGNING_PASSPHRASE | The passphrase used to import an existing key or generate a new key on startup. | |
GENERATE_GPG_KEY | false | Set to 'true' to generate a GPG key (for signatures) on startup. |
GPG_KEY_NAME | docker-backup | The name used when generating a new GPG key. |
GPG_KEY_EMAIL | [email protected] | The e-mail used when generating a new GPG key. |
GPG_KEY_LENGTH | 2048 | The length of the DSA key when generating a new GPG key. Either 2048 or 4096. |
VERIFY_SIGNATURES | false | Set to 'true' to enable checksum signature verification. |
SKIP_PASSPHRASE_LENGTH_CHECK | false | Skips the passphrase length control on startup. Don't use this in production environments. |
KEEP_BACKUPS_FOR_DAYS | 30 | Set to how many days you want to keep backups in the short-term backup folder. |
KEEP_LTS_FOR_MONTHS | 6 | Set to how long you want to keep long-term storage backups. |
KEEP_DAILY_AFTER_HOURS | 24 | The breakpoint (in hours) for when hourly backups turn into daily. |
KEEP_WEEKLY_AFTER_DAYS | 14 | The breakpoint (in days) for when daily backups turn into weekly. |
KEEP_MONTHLY_AFTER_WEEKS | 4 | The breakpoint (in weeks) for when weekly backups turn into monthly. |
MINIMUM_FREE_SPACE | 30 | Set to how many gigabytes of storage you want to keep free. |
LOCK_TIMEOUT | 600 | How long the scripts should wait for other scripts to finish before giving up. |
PROJECT_NAME | The name of the project folder (used for naming containers with docker-compose). | |
PAUSE_CONTAINERS | The names of the containers that should be stopped before backing up & restoring. Comma-separated list. | |
TZ | UTC | The timezone used for setting timestamps (and comparing times) on backups. |
See the Environment variables wiki page for a full list of environment variables, and more information about them.
You can use docker-compose exec backup <command> to run the following commands inside the container:
| Command | Description |
|---|---|
backup [volume] | Creates backups of all (or specific) volumes. |
store [volume] | Copies the latest backups to the long-term storage location. |
prune [volume] | Prunes old backups to save disk space. |
restore [volume | backup] | Restores volumes to their latest (or a specific) backup. |
See the Commands wiki page for a full list of commands, and more information about them.
Submit a pull request! See the Development wiki page for information on how to get started with development.
If you're not a developer, you are more than welcome to submit an issue with a feature request or bug report.
Content type
Image
Digest
Size
36.1 MB
Last updated
over 5 years ago
docker pull niclaslindstedt/docker-backup