Public Repository

Last pushed: a year ago
Short Description
Simple nologin ssh server used for port forwarding.
Full Description

Tags and Dockerfiles

ssh-server for Docker

SSH Server that can be used for port forwarding or serving files. This can be useful when doing development or testing with --net=host and the docker host is not accessible to your local machine.


# generate ssh key.
ssh-keygen -t rsa -f id_rsa.key -N ''

# start container
docker run --name ssh -d --net host -v "":/etc/ssh/keys/ danisla/ssh-server:latest

# SSH and forward ports.
ssh -f -N -i ./id_rsa.key -L 8080:localhost:8080 nobody@<docker host ip>

The entrypoint script sets up the user and group, chowns the data dir and starts sshd.

The sshd_config is setup to read the authorized_keys file dynamically using the provided /usr/local/bin/ script so public keys just need to be mounted into the container at runtime.

Environment variables


UID of ssh user, default is 1000


GID of ssh user, default is 1000


User name of ssh user, default is nobody


Home directory of ssh user, default is /tmp


Directory in container where authorized public key files (*.pub) live.

Docker Pull Command

Comments (0)