Skip to content

pascaliske/docker-autorestic

Docker image based on the awesome cupcakearmy/autorestic.

Docker Image Version (tag latest semver) Docker Image Size (tag) Docker Pulls GitHub Tag Build Status License: MIT GitHub Last Commit Awesome Badges

Image

Registry Image
Docker Hub pascaliske/autorestic
GitHub ghcr.io/pascaliske/autorestic

The following platforms are available for this image:

$ docker run --rm mplatform/mquery pascaliske/autorestic:latest
Image: pascaliske/autorestic:latest
 * Manifest List: Yes
 * Supported platforms:
   - linux/amd64
   - linux/arm/v7
   - linux/arm64

Usage

To use this image pull it from one of the following registries:

# docker hub
docker pull pascaliske/autorestic

# github container registry
docker pull ghcr.io/pascaliske/autorestic

Create an initial config file (config.yml):

backends:
  my-backend:
    type: local
    path: /var/lib/autorestic/backends/my-backend
locations:
  my-location:
    from: /var/lib/autorestic/locations/my-location
    to:
      - my-backend
  my-volume:
    from: /var/lib/autorestic/locations/my-volume
    to:
      - my-backend

The following bind mounts are required:

Mount Description
/etc/autorestic/cache Your restic cache folder. Optional
/etc/autorestic/config.yml Your autorestic configuration file. Required
/var/lib/autorestic/locations All locations defined as from in the config file. Required
/var/lib/autorestic/backends All paths defined for backends with type: local in the config file. Required

Note: To backup volumes you can directly mount them in /var/lib/autorestic/locations and reference them as normal folder in the config file:

bash docker run --rm \ -v my-volume:/var/lib/autorestic/locations/my-volume \ ghcr.io/pascaliske/autorestic:latest backup --location my-volume

Run a backup with the required volume mounts:

$ docker run --rm \
    -v $(pwd)/config.yml:/etc/autorestic/config.yml \
    -v $(pwd)/cache:/etc/autorestic/cache \
    -v $(pwd)/my-backend:/var/lib/autorestic/backends/my-backend \
    -v $(pwd)/my-location:/var/lib/autorestic/locations/my-location \
    -v my-volume:/var/lib/autorestic/locations/my-volume \
    ghcr.io/pascaliske/autorestic:latest backup --location my-location

Restore a backup with the required volume mounts. The target folder should be bind mounted as well:

$ docker run --rm \
    -v $(pwd)/config.yml:/etc/autorestic/config.yml \
    -v $(pwd)/cache:/etc/autorestic/cache \
    -v $(pwd)/my-backend:/var/lib/autorestic/backends/my-backend \
    -v $(pwd)/my-location:/var/lib/autorestic/locations/my-location \
    -v my-volume:/var/lib/autorestic/locations/my-volume \
    -v $(pwd)/my-restore:/tmp/my-restore \
    ghcr.io/pascaliske/autorestic:latest restore --location my-location --from my-backend --to /tmp/my-restore

For a list of all commands and their usage visit the autorestic docs. An example usage can be found here.

License

MIT – © 2022 Pascal Iske