/docker-dropbear-backup

Set up Dropbear SSH server to allow remote backups using Borg, rsync or sftp-server

Primary LanguageShellGNU General Public License v3.0GPL-3.0

docker-pulls image-size

This Docker image sets up Dropbear inside a docker container that allows remote backups using Borg, rsync or sftp-server

Dropbear is a relatively small SSH server that runs on a variety of unix platforms.

Borg is a deduplicating backup software for various Unix-like operating systems.

rsync is a utility for efficiently transferring and synchronizing files between a computer and a storage drive and across networked computers.

sftp-server is a program that speaks the server side of SFTP protocol to stdout and expects client requests from stdin.

Installation

To use docker-dropbear-backup, follow these steps:

  1. Clone and start the container:

    docker run -p 2222:22 \
      -e BACKUP_USER=bob \
      -e BACKUP_UID=1000 \
      -v "${PWD}"/dropbear:/etc/dropbear \
      -v "${PWD}"/backups:/home/bob \
      docker.io/aguslr/dropbear-backup:latest
    
  2. Configure your backup software to connect to your Dropbear server's IP address on port 2222 with user BACKUP_USER.

Variables

The image is configured using environment variables passed at runtime. All these variables are prefixed by BACKUP_.

Variable Function Default Required
USER New user that will own the backups rbackup N
UID UID of the new user 11000 N

Authorized keys file

To allow certain users to use the server for backup, we can copy the SSH keys into the authorized_keys file (e. g. "${PWD}"/backups/.ssh/authorized_keys) with the format:

no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding SSH_KEY USER@HOST

Build locally

Instead of pulling the image from a remote repository, you can build it locally:

  1. Clone the repository:

    git clone https://github.com/aguslr/docker-dropbear-backup.git
    
  2. Change into the newly created directory and use docker-compose to build and launch the container:

    cd docker-dropbear-backup && docker-compose up --build -d