Connecting to host port from Docker container
In my case I wanted to connect to a MySQL database that my laptop was SSH’d to.
# I had port forwarding in my ssh connection to fwd port 3306, the mysql port.
LocalForward 3306 127.0.0.1:3306
# on my laptop I start the ssh connection (use -N if you don’t actually want the ssh terminal for the connection)
# On the laptop run Docker with net=host:
docker run -it –net=host ….
# Inside Docker get the IP of the host:
# Look for Gateway in output, in my case it is: 192.168.65.1
# this is the IP of your host from Docker’s perspective
# Command inside to test if Docker has access to the port on localhost:
nc 192.168.65.1 3306
# output something like