Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.32 KB

README.md

File metadata and controls

48 lines (34 loc) · 1.32 KB

SSH Docker jumpbox

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).

Building the image

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.

Starting 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

Listening on a non-standard port

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