Skip to content

Instantly share code, notes, and snippets.

@spraints
Created March 10, 2016 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spraints/35af18d3d02e57234bdf to your computer and use it in GitHub Desktop.
Save spraints/35af18d3d02e57234bdf to your computer and use it in GitHub Desktop.

I wanted to connect from a docker container on a prod server to an SVN server on my laptop today. The steps were tricky, so here they are:

ssh tunnel

Exposing the local port to the prod server is pretty straightforward

laptop$ ssh -R 4204:127.0.0.1:4204 myserver

docker networking

Letting docker access the server's 127.0.0.1:4204 took a little bit more digging to figure out.

laptop$ ssh myserver
server$ docker run -i -t --rm --net=host image:latest /bin/bash -l
docker$ curl http://127.0.0.1:4204
SUCCESS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment