mirror of
https://github.com/lobaro/restic-backup-docker.git
synced 2026-02-17 09:23:56 +00:00
Merge branch 'master' of https://github.com/lobaro/restic-backup-docker into upstream-master
This commit is contained in:
31
Dockerfile
31
Dockerfile
@@ -1,26 +1,28 @@
|
||||
FROM alpine as certs
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
|
||||
FROM busybox:glibc
|
||||
|
||||
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
|
||||
|
||||
# Get restic executable
|
||||
ENV RESTIC_VERSION=0.9.5
|
||||
ADD https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 /
|
||||
RUN bzip2 -d restic_${RESTIC_VERSION}_linux_amd64.bz2 && mv restic_${RESTIC_VERSION}_linux_amd64 /bin/restic && chmod +x /bin/restic
|
||||
|
||||
RUN mkdir -p /mnt/restic /var/spool/cron/crontabs /var/log
|
||||
FROM busybox:glibc
|
||||
|
||||
ENV RESTIC_REPOSITORY=/mnt/restic
|
||||
ENV RESTIC_PASSWORD=""
|
||||
ENV RESTIC_TAG=""
|
||||
ENV NFS_TARGET=""
|
||||
# By default backup every 6 hours
|
||||
ENV BACKUP_CRON="0 */6 * * *"
|
||||
ENV RESTIC_FORGET_ARGS=""
|
||||
ENV RESTIC_JOB_ARGS=""
|
||||
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
|
||||
COPY --from=certs /bin/restic /bin/restic
|
||||
|
||||
RUN \
|
||||
mkdir -p /mnt/restic /var/spool/cron/crontabs /var/log; \
|
||||
touch /var/log/cron.log;
|
||||
|
||||
ENV \
|
||||
RESTIC_REPOSITORY=/mnt/restic \
|
||||
RESTIC_PASSWORD="" \
|
||||
RESTIC_TAG="" \
|
||||
NFS_TARGET="" \
|
||||
BACKUP_CRON="0 */6 * * *" \
|
||||
RESTIC_FORGET_ARGS="" \
|
||||
RESTIC_JOB_ARGS=""
|
||||
|
||||
# /data is the dir where you have to put the data to be backed up
|
||||
VOLUME /data
|
||||
@@ -28,7 +30,6 @@ VOLUME /data
|
||||
COPY backup.sh /bin/backup
|
||||
COPY entry.sh /entry.sh
|
||||
|
||||
RUN touch /var/log/cron.log
|
||||
|
||||
WORKDIR "/"
|
||||
|
||||
|
||||
24
README.md
24
README.md
@@ -4,19 +4,19 @@ A docker container to automate [restic backups](https://restic.github.io/)
|
||||
This container runs restic backups in regular intervals.
|
||||
|
||||
* Easy setup and maintanance
|
||||
* Support for different targets (currently: Local, NFS, SFTP)
|
||||
* Support for different targets (tested with: Local, NFS, SFTP, AWS)
|
||||
* Support `restic mount` inside the container to browse the backup files
|
||||
|
||||
**Container**: [lobaro/restic-backup-docker](https://hub.docker.com/r/lobaro/restic-backup-docker/)
|
||||
|
||||
Stable
|
||||
```
|
||||
docker pull lobaro/restic-backup-docker:v1.0
|
||||
docker pull lobaro/restic-backup-docker:1.2-0.9.4
|
||||
```
|
||||
|
||||
Latest (experimental)
|
||||
```
|
||||
docker pull lobaro/restic-backup-docker
|
||||
docker pull lobaro/restic-backup-docker:latest
|
||||
```
|
||||
|
||||
Please don't hesitate to report any issue you find. **Thanks.**
|
||||
@@ -50,7 +50,7 @@ To enter your container execute
|
||||
docker exec -ti backup-test /bin/sh
|
||||
```
|
||||
|
||||
Now you can use restic [as documented](https://restic.readthedocs.io/en/stable/Manual/), e.g. try to run `restic snapshots` to list all your snapshots.
|
||||
Now you can use restic [as documented](https://restic.readthedocs.io/en/stable/), e.g. try to run `restic snapshots` to list all your snapshots.
|
||||
|
||||
## Logfiles
|
||||
Logfiles are inside the container. If needed you can create volumes for them.
|
||||
@@ -84,7 +84,7 @@ The container is setup by setting [environment variables](https://docs.docker.co
|
||||
|
||||
## Set the hostname
|
||||
|
||||
Since 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.
|
||||
Since restic saves the hostname with each snapshot and the hostname of a docker container is derived from it's id you might want to customize this by setting the hostname of the container to another value.
|
||||
|
||||
Either 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)
|
||||
|
||||
@@ -98,16 +98,12 @@ Now you can simply specify the restic repository to be an [SFTP repository](http
|
||||
-e "RESTIC_REPOSITORY=sftp:user@host:/tmp/backup"
|
||||
```
|
||||
|
||||
# Changelog
|
||||
# Versioning & Changelog
|
||||
|
||||
Versioning follows [Semantic versioning](http://semver.org/)
|
||||
Starting from v1.3.0 versioning follows [Semantic versioning](http://semver.org/)
|
||||
|
||||
! Breaking changes
|
||||
Build metadata is used to declare the Restic version.
|
||||
|
||||
**:latest**
|
||||
* ! `--prune` must be passed to `RESTIC_FORGET_ARGS` to execute prune after forget.
|
||||
* Switch to base Docker container to `golang:1.7-alpine` to support latest restic build.
|
||||
**Example:** 1.3.0+0.9.5 (includes Restic 0.9.5)
|
||||
|
||||
|
||||
**:v1.0**
|
||||
* First stable version
|
||||
For changelog see: https://github.com/lobaro/restic-backup-docker/releases
|
||||
|
||||
Reference in New Issue
Block a user