Docker container running OpenSSH server:
~/.ssh/authorized_keys from an environment variableRun like this:
docker run -d -e AUTHORIZED_KEYS="..." -p 2222:22 robbertkl/ssh
You can then SSH with user root.
AUTHORIZED_KEYS (comma-separated list of SSH keys)Fresh host keys for OpenSSH are generated on first run. This is fine, but when later recreating the container (like after pulling a new image) they are generated again and you'll get an error trying to SSH because the old one is in your .ssh/known_hosts.
If you don't want to fix this every time after an upgrade, you can preserve the host keys in a number of ways:
/etc/ssh in a Docker volume (not recommended because you won't get sshd_config changes in new versions)This repo is published under the MIT License.
Content type
Image
Digest
sha256:ca57551ce…
Size
5.5 MB
Last updated
over 2 years ago
docker pull robbertkl/ssh