Skip to content
Run automatic restic backups via a Docker container.
Branch: master
Clone or download
Pull request Compare This branch is even with djmaze:master.
Latest commit 8e2b9d8 Jun 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.drone.yml Build on arm64 as well May 21, 2019
Dockerfile Update alpine to 3.9 Jun 10, 2019
LICENSE Create LICENSE Nov 3, 2017
Makefile Add badges to readme Nov 25, 2018
docker-compose.example.yml Add documentation and example configs Nov 3, 2017
docker-swarm.example.yml Add documentation and example configs Nov 3, 2017
entrypoint Fix exec'ing restic with multiple args Jun 28, 2018


Docker Pulls Build status

Run automatic restic backups via a Docker container.


  • run scheduled backups
  • backup to any (local or remote) target supported by restic
  • add custom tags to backups
  • automatic forgetting of old backups
  • can be used as a (global) Docker swarm service in order to backup every cluster node
  • multi-arch: the image mazzolino/restic runs on amd64 as well as armv7 (for now)


Use the supplied example configs to set up a backup schedule.

With Docker Compose

Adjust the supplied docker-compose.yml as needed. Then run:

docker-compose up -d

With Docker Swarm mode

Adjust the supplied docker-swarm.yml as needed. Then deploy it as a stack:

docker stack deploy -f docker-swarm.yml backup

Advanced usage

You can use the same config to run any restic command with the given configuration.

When using the Docker Compose setup:

docker-compose run --rm app <RESTIC ARGS>


docker-compose run --rm app snapshots

Configuration options

  • BACKUP_CRON - A cron expression for when to run the backup. E.g. 0 30 3 * * * in order to run every night at 3:30 am. See the go-cron documentation for details on the expression format
  • RESTIC_REPOSITORY - location of the restic repository. You can use any target supported by restic. Default /mnt/restic
  • RESTIC_BACKUP_SOURCES - source directory to backup. Make sure to mount this into the container as a volume (see the example configs). Default /data
  • RESTIC_PASSWORD - password for the restic repository. Will also be used to initialize the repository if it is not yet initialized
  • RESTIC_BACKUP_TAGS - Optional. Tags to set on each snapshot, separated by commas. E.g. swarm,docker-volumes
  • RESTIC_FORGET_ARGS - Optional. If specified restic forget is run with the given arguments after each backup. E.g. --prune --keep-last 14 --keep-daily 1
  • (Additional variables as needed for the chosen backup target. E.g. B2_ACCOUNT_ID and B2_ACCOUNT_KEY for Backblaze B2.)

Build instructions

Use the supplied Makefile in order to build your own image:

make image IMAGE=myuser/restic

You can also push images and build on a different architecture:

make image IMAGE=myuser/restic ARCH=arm

For more targets, see the Makefile.


restic-backup-docker was used as a starting point. Thanks!

You can’t perform that action at this time.