Skip to content

ferllings/docker-restic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 

Repository files navigation

restic

Logo

GitHub Docker Pulls Discord Upstream

Starting the container

Just the basics to get the container running:

docker run --rm --name restic --hostname <your_hostname> -v /<host_folder_config>:/config hotio/restic

The environment variables below are all optional, the values you see are the defaults.

-e PUID=1000
-e PGID=1000
-e UMASK=002
-e TZ="Etc/UTC"
-e ARGS=""

Tags

Tag Description Build Status Last Updated
latest The same as stable
stable Stable version Build Status GitHub last commit (branch)

You can also find tags that reference a commit or version number.

Configuration

Create the file /config/app/crontab (see example below) and put your restic backup script along with other required files in /config/app/. Rclone configuration can be placed in /config/.config/rclone/rclone.conf. When the container starts, the crontab file will be installed. A container restart is needed when you've modified your crontab file, for the changes to apply.

Example crontab file /config/app/crontab:

* * * * * hotio /config/app/backup-every-minute.sh
@hourly root /config/app/backup-hourly.sh

Example backup script /config/app/backup-hourly.sh:

#!/bin/bash

export RCLONE_CONFIG="/config/.config/rclone/rclone.conf"

echo "Creating backup..."
restic --repo rclone:amazon:backup --password-file /config/app/encryption.key --cache-dir /config/.cache/restic backup --exclude-caches /documents
restic --repo rclone:amazon:backup --password-file /config/app/encryption.key --cache-dir /config/.cache/restic backup --exclude-caches /pictures

Additional docker volumes:

-v /storage/documents:/documents:ro
-v /storage/pictures:/pictures:ro

Executing your own scripts

If you have a need to do additional stuff when the container starts or stops, you can mount your script with -v /docker/host/my-script.sh:/etc/cont-init.d/99-my-script to execute your script on container start or -v /docker/host/my-script.sh:/etc/cont-finish.d/99-my-script to execute it when the container stops. An example script can be seen below.

#!/usr/bin/with-contenv bash

echo "Hello, this is me, your script."