diff --git a/Dockerfile b/Dockerfile index 930d9a8..05a308d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,8 @@ RUN apk add borgbackup # Create host keys to allow SSHD to start RUN ssh-keygen -A +RUN adduser -D -h /opt/borg borg + COPY ./entrypoint.sh /entrypoint.sh CMD ["/entrypoint.sh"] diff --git a/README.md b/README.md index 8e83d95..2449234 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ To use this container, run the supplied `docker-compose.yml` and substitute the Create your first repository against the container using: ``` -borg init -e repokey borg@:/opt/borg/ +borg init -e repokey borg@[IP]:/opt/borg/ ``` If you have selected another port other than 22, you can change the port used by borg by running `export BORG_RSH="ssh -p "` on the client running the backup command. diff --git a/docker-compose.yml b/docker-compose.yml index 8f0dc3d..4308697 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,6 @@ services: - 22:22 volumes: - ./borg:/opt/borg - - ssh-keys:/home/borg/.ssh environment: - SSH_PASSWORD=value restart: always - -volumes: - ssh-keys: diff --git a/entrypoint.sh b/entrypoint.sh index 515ec94..be183b9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,23 +1,8 @@ #!/bin/sh -# Create backup user -echo "Creating borg backup user" -adduser -D borg - # Set ssh password echo "Updating password..." echo "borg:$SSH_PASSWORD" | chpasswd -# Change borg folder ownership to be owned by borg -echo "Setting file ownership" -chown -R borg:borg /opt/borg - -# Create ssh directory and ensure permissions -mkdir /home/borg/.ssh -chown borg:borg /home/borg/.ssh - -# Set default login path to /opt/borg -echo 'cd /opt/borg' >> /home/borg/.profile - # Start SSHD /usr/sbin/sshd -D