Go to file
Einar Forselv 8d93d478de Temp disable local backup run 2019-04-14 01:35:14 +02:00
restic-backup Temp disable local backup run 2019-04-14 01:35:14 +02:00
.dockerignore Initial 2019-04-13 19:04:54 +02:00
.gitignore Populate gitignore 2019-04-13 19:27:41 +02:00
Dockerfile Added packages for mysql and postgres 2019-04-13 23:29:28 +02:00
README.md Indent issue 2019-04-14 00:58:28 +02:00
requirements.txt Initial 2019-04-13 19:04:54 +02:00

README.md

restic-volume-backup

WORK IN PROGRESS

Backup using using https://restic.net/ for a docker-compose setup.

Automatically detects and backs up volumes in a docker-compose setup. This includes both host mapped volumes and actual docker volumes.

  • Cron triggers backup
  • Volumes for all running containers are backed up

Configuration

Required env variables for restic:

RESTIC_REPOSITORY
RESTIC_PASSWORD

Example compose setup:

version: '3'
services:
  backup:
    build: restic-volume-backup
    environment:
      - RESTIC_REPOSITORY=<whatever restic supports>
      - RESTIC_PASSWORD=hopefullyasecturepw
    env_file:
      - some_other_vars.env
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
  example:
    image: some_image
    # Enable volume backup with label
    labels:
      restic-volume-backup.enabled: true
    # These volumes will be backed up
    volumes:
      # Docker volume
      - media:/srv/media
      # Host map
      - /srv/files:/srv/files

volumes:
  media:

Include

  example:
    image: some_image
    labels:
      restic-volume-backup.enabled: true
      restic-volume-backup.include: "files,data"
    volumes:
      # Source don't match include filter. No backup.
      - media:/srv/media
      # Matches include filter
      - files:/srv/files
      - /srv/data:/srv/data

volumes:
  media:
  files:

Exclude:

  example:
    image: some_image
    labels:
      restic-volume-backup.enabled: true
      restic-volume-backup.exclude: "media"
    volumes:
      # Excluded by filter
      - media:/srv/media
      # Backed up
      - files:/srv/files
      - /srv/data:/srv/data

volumes:
  media:
  files: