Docker image to run an SSH tunnel
265
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.
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!
| Variable | Required? | Description |
|---|---|---|
| SSH_HOST | Yes | SSH host to connect to. Format is user@host. |
| SSH_KEY | Yes | SSH key to identify with. |
| TARGET_HOST | Yes | Tunnel target hostname. |
| TARGET_PORT | Yes | Tunnel target port. |
| SSH_EXTRA_OPTS | No | Any extra SSH options, eg -v -o [email protected] |
| SERVER_ALIVE_INTERVAL | No | ServerAliveInterval is set to 10 by default (to disconnect within 30 seconds of network interruption), but you can override it here. |
Content type
Image
Digest
Size
6.3 MB
Last updated
over 6 years ago
docker pull alexjurkiewicz/ssh-tunnel