first commit of a working dockerfile
This commit is contained in:
parent
d6569d3c64
commit
833049e189
2 changed files with 90 additions and 1 deletions
25
Dockerfile
Normal file
25
Dockerfile
Normal file
|
@ -0,0 +1,25 @@
|
|||
FROM debian:stretch-slim
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y
|
||||
|
||||
RUN apt-get install -y openssh-server && \
|
||||
mkdir -p /var/run/sshd
|
||||
|
||||
RUN apt-get install -y rsync borgbackup ca-certificates
|
||||
|
||||
ADD https://github.com/restic/restic/releases/download/v0.9.4/restic_0.9.4_linux_amd64.bz2 /tmp/
|
||||
|
||||
RUN bunzip2 /tmp/restic_0.9.4_linux_amd64.bz2 && mv /tmp/restic_0.9.4_linux_amd64 /usr/local/bin/restic && chmod +x /usr/local/bin/restic
|
||||
|
||||
RUN mkdir -p /bkup/.ssh \
|
||||
&& groupadd -g 1111 bkup \
|
||||
&& useradd -u 1111 -g 1111 -d /bkup bkup \
|
||||
&& passwd -l bkup \
|
||||
&& chown -Rh bkup:bkup /bkup
|
||||
|
||||
VOLUME /bkup
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
CMD /usr/sbin/sshd -De
|
66
README.md
66
README.md
|
@ -1,2 +1,66 @@
|
|||
# backup-server
|
||||
Docker based backup server
|
||||
Docker based ssh backup host with `borg` and `restic` installed. Can be effectively used for as a backup repository and a tool to backup containers.
|
||||
|
||||
## Run a backup host and backup a client with `borg`
|
||||
|
||||
Run the backup host with this command:
|
||||
docker run -d \
|
||||
--restart always \
|
||||
--port 22:22 \
|
||||
--volume /mnt/backup:/bkup \
|
||||
--name backup \
|
||||
amdavidson/backup:latest
|
||||
|
||||
Add your ssh key to the host:
|
||||
docker cp id_rsa.pub backup:/bkup/.ssh/authorized_keys
|
||||
docker run --volumes-from backup amdavidson/backup-server chown 1111:1111 /bkup/.ssh/authorized_keys
|
||||
|
||||
|
||||
Create a repository for backups:
|
||||
borg init backup:/bkup/client-name
|
||||
|
||||
Periodically run a backup with a command similar to this:
|
||||
borg create --stats --verbose backup:/bkup/client-name::$(date '+%s') ~/
|
||||
|
||||
## Backup a container with `restic`
|
||||
|
||||
Create a repository for backups:
|
||||
docker run \
|
||||
--rm \
|
||||
--volumes-from backup \
|
||||
--env RESTIC_PASSWORD=secretpw \
|
||||
--env AWS_ACCESS_KEY_ID=asvc0832n20vasfdh0 \
|
||||
--env AWS_SECRET_ACCESS_KEY=aokjsvdn0e2nc08va80428b308jcwa08je02983jr032 \
|
||||
amdavidson/backup-server \
|
||||
restic -r s3:s3.wasabisys.com/other-container init
|
||||
|
||||
Perodically run a backup with a command similar to this:
|
||||
docker run \
|
||||
--rm \
|
||||
--volumes-from backup \
|
||||
--volumes-from other-container:ro \
|
||||
--env RESTIC_PASSWORD=secretpw \
|
||||
--env AWS_ACCESS_KEY_ID=asvc0832n20vasfdh0 \
|
||||
--env AWS_SECRET_ACCESS_KEY=aokjsvdn0e2nc08va80428b308jcwa08je02983jr032 \
|
||||
amdavidson/backup-server \
|
||||
restic -r s3:s3.wasabisys.com/other-container backup /data
|
||||
|
||||
## Backup a container with `borg`
|
||||
|
||||
Create a repository for backups:
|
||||
docker run \
|
||||
--rm \
|
||||
--volumes-from backup \
|
||||
amdavidson/backup-server \
|
||||
borg init /bkup/other-container
|
||||
|
||||
Periodically run a backup with a command similar to this:
|
||||
docker run \
|
||||
--rm \
|
||||
--volumes-from backup \
|
||||
--volumes-from other-container:ro \
|
||||
amdavidson/backup-server \
|
||||
borg create --verbose --stats /bkup/other-container::$(date '+%s') /data
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue