{"id":18115002,"url":"https://github.com/janw/docker-restic","last_synced_at":"2025-08-21T03:31:42.673Z","repository":{"id":98526258,"uuid":"195627032","full_name":"janw/docker-restic","owner":"janw","description":"Restic docker container with support for reporting success/failure to https://healthchecks.io","archived":false,"fork":false,"pushed_at":"2024-01-02T13:56:52.000Z","size":90,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-01T03:07:40.238Z","etag":null,"topics":["docker","healthchecksio","restic"],"latest_commit_sha":null,"homepage":"https://ghcr.io/janw/restic","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"liberapay":"janw","issuehunt":"janw"}},"created_at":"2019-07-07T08:20:48.000Z","updated_at":"2024-07-18T09:49:49.000Z","dependencies_parsed_at":"2024-01-01T23:44:19.318Z","dependency_job_id":null,"html_url":"https://github.com/janw/docker-restic","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janw%2Fdocker-restic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janw%2Fdocker-restic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janw%2Fdocker-restic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janw%2Fdocker-restic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janw","download_url":"https://codeload.github.com/janw/docker-restic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230487717,"owners_count":18233857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","healthchecksio","restic"],"created_at":"2024-11-01T03:07:43.733Z","updated_at":"2024-12-19T18:44:06.932Z","avatar_url":"https://github.com/janw.png","language":"Shell","funding_links":["https://liberapay.com/janw","https://issuehunt.io/r/janw"],"categories":[],"sub_categories":[],"readme":"# Restic Backup Docker Container\n\nA docker container to automate [restic backups](https://restic.github.io/)\n\nThis container runs restic backups as one-off jobs and supports reporting to [healthchecks.io](https://healthchecks.io)\n\n* Easy setup and maintenance\n* Support for different Restic targets configurable through environment variables\n* Support `restic mount` inside the container to browse the backup files\n\n**Container**: [ghcr.io/janw/restic](https://github.com/janw/docker-restic/pkgs/container/restic)\n\nLatest\n\n```bash\ndocker pull ghcr.io/janw/restic\n```\n\nPlease don't hesitate to report any issue you find. Thanks.\n\n## Environment variables\n\nThe container is setup by setting [environment variables](https://docs.docker.com/engine/reference/run/#/env-environment-variables) and [volumes](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems).\n\n* `RESTIC_PASSWORD` — **Required.** The password for the restic repository. Will also be used for restic init during first start when the repository is not initialized.\n* `RESTIC_REPOSITORY` — Optional. The location of the restic repository. Defaults to `/target`, so externally mounted repositories (NFS, SSHFS, etc.) should be mounted at `/target` into the container. For S3, this should be `s3:https://s3.amazonaws.com/BUCKET_NAME`\n* `RESTIC_FORGET_ARGS` — Optional.`restic forget` will be run when this is set with the given arguments after each backup. Example argument:\n\n    ```-e \"RESTIC_FORGET_ARGS=--prune --keep-last 10 --keep-hourly 24 --keep-daily 7 --keep-weekly 52 --keep-monthly 120 --keep-yearly 100\"```\n\n* `RESTIC_JOB_ARGS` — Optional. Allows to specify extra arguments to the backup job such as limiting bandwith with `--limit-upload` or excluding file masks with `--exclude`.\n* Of course other [Restic environment configuration variables](https://restic.readthedocs.io/en/latest/040_backup.html#environment-variables) are supported as well.\n\n## Volumes\n\n* `/data` - This is the data that gets backed up. Just [mount](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) it to wherever you want.\n* `/target` - This is the default target repository to back up to. Just [mount](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) your repository there, or adjust the `RESTIC_REPOSITORY` variable if you require other means of connecting to the repository (S3, Backblaze B2, etc.).\n\n## Set the hostname\n\nSince restic saves the hostname with each snapshot and the hostname of a docker container is it's id you might want to customize this by setting the hostname of the container to another value.\n\nEither by setting the [environment variable](https://docs.docker.com/engine/reference/run/#env-environment-variables) `HOSTNAME` or with `--hostname` in the [network settings](https://docs.docker.com/engine/reference/run/#network-settings)\n\n## Backup to SFTP\n\nSince restic needs a **password less login** to the SFTP server make sure you can do `sftp user@host` from inside the container. If you can do so from your host system, the easiest way is to just mount your `.ssh` folder conaining the authorized cert into the container by specifying `-v ~/.ssh:/root/.ssh` as argument for `docker run`.\n\nNow you can simply specify the restic repository to be an [SFTP repository](https://restic.readthedocs.io/en/stable/Manual/#create-an-sftp-repository).\n\n```bash\n-e \"RESTIC_REPOSITORY=sftp:user@host:/tmp/backup\"\n```\n\n## Backups in a Kubernetes CronJob\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: backup-to-backblaze-b2\n  namespace: backups\nspec:\n  schedule: \"@weekly\"\n  concurrencyPolicy: Forbid\n  startingDeadlineSeconds: 300\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          hostname: k\n          restartPolicy: Never\n          containers:\n            - name: restic\n              image: ghcr.io/janw/restic:latest\n              imagePullPolicy: Always\n              env:\n                - name: RESTIC_REPOSITORY\n                  value: b2:my-backblaze-b2-bucket:k\n                - name: HEALTHCHECK_URL\n                  value: https://hc-ping.com/deadbeef-1234-1234-1234-123456789012\n                - name: RESTIC_JOB_ARGS\n                  value: --verbose\n\n                # These should be put in a Secret resource instead!\n                - name: RESTIC_PASSWORD\n                  value: \"my_super_secret_backups_password\"\n                - name: B2_ACCOUNT_ID\n                  value: \"abdc12039812039821098\"\n                - name: B2_ACCOUNT_KEY\n                  value: \"my_secret_key\"\n\n              volumeMounts:\n              - mountPath: /root/.cache/restic\n                name: restic-cache\n              - mountPath: /data\n                name: backup-data\n          volumes:\n          - name: restic-cache\n            hostPath:\n              path: /var/restic-cache\n          - name: backup-data\n            hostPath:\n              path: /mnt/data-to-backup\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanw%2Fdocker-restic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanw%2Fdocker-restic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanw%2Fdocker-restic/lists"}