This is probably more suited to be a Stack Overflow answer, but I figured the answer is so interesting, I’d write a Medium post about it.

First of all, let’s define the problem:

Until this day, developers that wanted to create an SSH tunnel for development purposes only had to spin up another terminal and run an SSH command with a forward tunnel command, e.g.

ssh -N -L 3306:mysqlserver.internal:3306 user@bastion.com

They would then configure their development environment to connect to localhost:3306 for their MySQL server, instead of connecting directly to the unexposed mysqlserver.internal.

Image for post
Image for post
Tunneling without Docker

In 2020, you are likely using Docker to develop your very cool application, which means your application’s network is no longer your host’s network. This means that naively connecting to localhost:3306 will simply not work.


Ron Reiter

An entrepreneur, and a web expert.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store