muesli / docker-backup

A tool to create & restore complete, self-contained backups of Docker containers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Excluding mapped system volumes

andrewleech opened this issue · comments

I've got a number of docker containers (mostly related to home assistant) that use mapped volumes to access things like /dev, /run/dbus and /run/udev.

I'm currently using restic with docker-backup as described in the readme, however it tries to include all the files from these system dirs in the backup which causes restic to fail.

It would be great if some form of --exclude arguments could be given to docker-backup to provide paths to not include in the file listing.

As a workaround, I'm running docker-backup as such:

sudo docker-backup backup --all --stopped --launch "./.restic %tag %list"

where ./.restic is a wrapper script to filter the list and set the required variable for restic:

#!/bin/bash
export export RESTIC_REPOSITORY="b2:DATA:/"
export B2_ACCOUNT_ID=<MYID>
export B2_ACCOUNT_KEY=<MYKEY>

TAG="$1"
LIST="$2"

sed -r -i.bak '/^(\/dev|\/var\/run\/|\/sys\/|\/run\/|\/etc\/machine-id)/d' "$LIST"

restic backup -r "$RESTIC_REPOSITORY" --password-file .passwd  --tag "$TAG" --files-from "$LIST" >> restic.log 2>&1