Sign inSign up

alexjurkiewicz/ssh-tunnel

By alexjurkiewicz

•Updated over 6 years ago

Docker image to run an SSH tunnel

Image
0

265

alexjurkiewicz/ssh-tunnel repository overview

⁠Docker SSH Tunnel Image

This image lets you easily set up a SSH tunnel. This is different to existing solutions on Docker Hub⁠ because it doesn't require any files to be mounted -- all configuration is provided in the environment.

⁠Usage

docker run \
  -e SSH_KEY="$(cat ~/.ssh/id_rsa)" \
  -e [email protected] \
  -e TARGET_HOST=mysql.company.internal \
  -e TARGET_PORT=3306 \
  -p 10000:10000 \
  alexjurkiewicz/ssh-tunnel:latest

This will SSH to SSH_HOST and set up a tunnel to TARGET_HOST:TARGET_PORT. The tunnel will be exposed on port 10000. You can test the tunnel by running this in another terminal window:

mysql -h localhost -P 10000 # works!

⁠Environment Variables

VariableRequired?Description
SSH_HOSTYesSSH host to connect to. Format is user@host.
SSH_KEYYesSSH key to identify with.
TARGET_HOSTYesTunnel target hostname.
TARGET_PORTYesTunnel target port.
SSH_EXTRA_OPTSNoAny extra SSH options, eg -v -o [email protected]
SERVER_ALIVE_INTERVALNoServerAliveInterval is set to 10 by default (to disconnect within 30 seconds of network interruption), but you can override it here.

Tag summary

Content type

Image

Digest

Size

6.3 MB

Last updated

over 6 years ago

docker pull alexjurkiewicz/ssh-tunnel