Coder Social home page Coder Social logo

docker-restic-backup's Introduction

Scheduled Restic Backups with Docker

A docker container for running scheduled backups using restic.

Before building the docker image, edit the exclude file to set up glob patterns for any files that you wish not to backup.

Execute the following to build the docker image:

docker build -t restic-backup .

To create a backup that will run every day at 7 UTC, backing up the directory /source/data/to/backup/ to /destination/for/local/backup/, simply execute the following to create a new running docker container:

docker run --name restic-backup-local \
    -e SLACK_WEBHOOK="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" \
    -e RESTIC_PASSWORD="my_password" \
    -e RESTIC_TAG="backup_full" \
    -e BACKUP_CRON="0 7 * * *" \
    -v /source/data/to/backup/:/data:ro \
    -v /destination/for/local/backup/:/mnt/restic \
    -t restic-backup

Another example for backing up to Backblaze B2:

docker run --name restic-backup-b2 \
    -e SLACK_WEBHOOK="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" \
    -e RESTIC_PASSWORD="my_password" \
    -e RESTIC_TAG="backup_full" \
    -e RESTIC_REPOSITORY="b2:my-bucket-name" \
    -e B2_ACCOUNT_ID="123456789abc" \
    -e B2_ACCOUNT_KEY="0123456789abcdef0123456789abcdef0123456789" \
    -e BACKUP_CRON="0 7 * * *" \
    -v /source/data/to/backup/:/data:ro \
    -t restic-backup

When backing up a a local directory, the restic repository is automatically initialized by running restic init, allowing for no required initial setup; however, if running a backup to a remote destination such as B2, you must manually initialize the repository by running restic init --repo b2:my-bucket-name or the equivalent depending on the repository. The SLACK_WEBHOOK environment variable is optional, see incoming webhooks for more information. Any restic options can be configured as environment variables when creating the docker container, allowing you to backup to any natively supported remote destination supported by restic.

docker-restic-backup's People

Contributors

millerhederi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.