项目作者: approximatenumber

项目描述 :
backup utility for named volumes of your docker-compose services
高级语言: Python
项目地址: git://github.com/approximatenumber/compose-backuper-script.git


compose-backuper-script

Script to backup named volumes of your services from docker-compose.yml

It parses docker-compose.yml, finds named volume, runs a little container with these volumes mounted inside (ro) and saves it to backup file.

Little container is approximatenumber/compose-backuper.

Prepare

  1. Install needed python modules with virtualenv:
  1. virtualenv compose-backuper
  2. source compose-backuper/bin/activate
  3. pip install -r requirements.txt

(When you finish the backup, run deactivate to deactivate virtual environment)

  1. Pull the image for backup

docker pull approximatenumber/compose-backuper

Usage

Needed arguments:

  • docker-compose.yml (by default, script searches it in the current directory)
  • project name (by default, script takes current directory name)
  • destination directory to store backups.
  1. usage: compose-backup.py [-h] [-f COMPOSE_FILE] [-p PROJECT_NAME]
  2. [-d DESTINATION]
  3. optional arguments:
  4. -h, --help show this help message and exit
  5. -f COMPOSE_FILE, --compose-file COMPOSE_FILE
  6. path to docker-compose.yml
  7. -p PROJECT_NAME, --project-name PROJECT_NAME
  8. project name
  9. -d DESTINATION, --destination DESTINATION
  10. destination directory for backups

Example:

  1. python compose-backup.py -f ../opt/app/docker-compose.yml -p myproj -d /opt/backups/
  2. INFO:compose-backup:jenkins-home: saving...
  3. INFO:compose-backup:jenkins-home: saved
  4. INFO:compose-backup:DONE! Volumes saved: 1
  1. ls /opt/backups
  2. myproj_jenkins-home.tar.gz

Your contributions are appreciated!