Skip to content
Alpine SSH Client and Server
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Alpine SSH Client and Server

Minimal Alpine ssh client and server.

Quick Start

You can use the docker-compose file, to get up and running quickly.

$ export AUTHORIZED_KEY="ssh-rsa ..."
$ docker-compose up server
$ docker-compose run --rm client

If you do not have an SSH key, you can generate a passphrase-less one with:

$ ssh-keygen -t rsa -C "" -f id_rsa -N ''


This usage pattern shows how to have both a server and a client as docker containers. If you need only one side of it, skip whatever is not relevant.


First, create a network for the two containers to share:

$ docker network create -d bridge dockernet


Create an environment variable with your public key, then start the server.

$ export AUTHORIZED_KEY="ssh-rsa ..."
$ docker run --rm -it -e AUTHORIZED_KEY \
  --network dockernet \
  --entrypoint /sshd-entrypoint \
  --name server \


In another terminal, mount your private key and connect to the server:

$ docker run --rm -it \
  -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro \
  --network dockernet \
  dannyben/sshd \
  ssh server

Additional Information

You can’t perform that action at this time.