alpine ssh server
Branch: master
Clone or download
danielguerra69 Merge pull request #2 from duhaime/image-name
correct image name for password-based interactive session
Latest commit c6abd36 Jun 1, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Dockerfile Merge branch 'master' into edge Feb 26, 2017
Readme.md correct image name for password-based interactive session Jun 1, 2018
docker-entrypoint.sh update Sep 19, 2016

Readme.md

Alpine ssh server

Instructions

Key based usage (prefered)

Copy the id_rsa.pub from your workstation to your dockerhost. On the dockerhost create a volume to keep your authorized_keys.

tar cv --files-from /dev/null | docker import - scratch
docker create -v /root/.ssh --name ssh-container scratch /bin/true
docker cp id_rsa.pub ssh-container:/root/.ssh/authorized_keys

For ssh key forwarding use ssh-agent on your workstation.

ssh-agent
ssh-add id_rsa

Then the start sshd service on the dockerhost (check the tags for alpine versions)

docker run -p 4848:22 --name alpine-sshd --hostname alpine-sshd --volumes-from ssh-container  -d danielguerra/alpine-sshd

Password based

docker run -p 4848:22 --name alpine-sshd --hostname alpine-sshd -d danielguerra/alpine-sshd
docker exec -ti alpine-sshd passwd

From your workstation

ssh to your new docker environment, with an agent the -i option is not needed

ssh -p 4848 -i id_rsa root@<dockerhost>