From ec5d05b44c5209703cd1ea17a758e583d5505612 Mon Sep 17 00:00:00 2001 From: b3vis Date: Mon, 15 Aug 2016 09:43:31 +0100 Subject: [PATCH] Initial Commit --- Dockerfile | 16 ++++++++++++++++ README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ supervisord.conf | 5 +++++ 3 files changed, 70 insertions(+) create mode 100755 Dockerfile create mode 100755 README.md create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..c147b1f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM alpine:latest +MAINTAINER b3vis +#Install Borg & SSH +RUN apk add openssh sshfs borgbackup supervisor --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ +RUN adduser -D -u 1000 borg && \ + ssh-keygen -A && \ + mkdir /backups && \ + chown borg.borg /backups && \ + sed -i \ + -e 's/^#PasswordAuthentication yes$/PasswordAuthentication no/g' \ + -e 's/^PermitRootLogin without-password$/PermitRootLogin no/g' \ + /etc/ssh/sshd_config +COPY supervisord.conf /etc/supervisord.conf +RUN passwd -u borg +EXPOSE 22 +CMD ["/usr/bin/supervisord"] diff --git a/README.md b/README.md new file mode 100755 index 0000000..a51f337 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# Borg Backup Server Container + +## Description + +My take on a Borgbackup Server as a Docker container to facilicate the backing up of remote machines using [Borgbackup](https://github.com/borgbackup) +--- +## Dockerfile +``` +FROM alpine:latest +MAINTAINER b3vis +#Install Borg & SSH +RUN apk add openssh sshfs borgbackup supervisor --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ +RUN adduser -D -u 1000 borg && \ + ssh-keygen -A && \ + mkdir /backups && \ + chown borg.borg /backups && \ + sed -i \ + -e 's/^#PasswordAuthentication yes$/PasswordAuthentication no/g' \ + -e 's/^PermitRootLogin without-password$/PermitRootLogin no/g' \ + /etc/ssh/sshd_config +COPY supervisord.conf /etc/supervisord.conf +RUN passwd -u borg +EXPOSE 22 +CMD ["/usr/bin/supervisord"] +``` +--- + +## Usage + +I personally like to split my ssh keys out of the main container to make updates and management easier. To achieve this I create a persistent storage container; + +`docker run -d -v /home/borg/.ssh --name borg-keys-storage busybox:latest` + +* Container Creation: + +``` +docker create \ + --name=borg-server \ + --restart=always \ + --volumes-from borg-keys-storage \ + -v path/to/backups:/backups \ + -p 2022:22 \ + b3vis/borg-server +``` + +* Note: + +After creating the container you will need to start the container add your own public keys +--- diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..eb23757 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,5 @@ +[supervisord] +nodaemon=true + +[program:sshd] +command=/usr/sbin/sshd -D