Forked from https://github.com/monsoft/ssh-docker-jumpbox, who based on https://github.com/warden/docker-jumpbox.
This version uses environment variables for a single user and public key, and
prevents the user from logging in. This can only be used for creating reverse
tunnels (ssh's -R
option) without an interactive session (ssh's -N
option).
To build the docker image locally, clone this repo and run the build command:
cd ssh-docker-jumpbox
docker build --rm -t ssh-jumpbox .
Then refer to the image as ssh-jumpbox
instead of joeyparrish/ssh-jumpbox
.
Copy your desired public key and username into docker environment variables. In this example, we expose port 22 in the container as port 1022 in the host.
docker run \
-d \
-e JUMP_USER="foo" \
-e JUMP_PUBLIC_KEY="ssh-rsa G5k8URQHMcu1DU1A58WhE6yy foo@bar" \
-p 1022:22 joeyparrish/ssh-jumpbox
If you don't want to map ports in the way shown above, you can also override
the default SSH port of 22 with the JUMP_PORT
environment variable:
docker run \
-d \
-e JUMP_USER="foo" \
-e JUMP_PUBLIC_KEY="ssh-rsa G5k8URQHMcu1DU1A58WhE6yy foo@bar" \
-e JUMP_PORT="1022" \
-p 1022 joeyparrish/ssh-jumpbox