I'm trying to connect to a remote mongo-db instance that has restricted access to its local network. So, I create an ssh tunnel, which allows me to connect:
ssh -L [port]:localhost:[hostport] [username]@[remote-ip]
However, when I want to connect to the same mongo-db service from a docker container the connection times out.
I tried to specify a bind address like so
ssh -L 172.17.0.1:[port]:localhost:[host-port] [username]@[remote-ip]
And connect to the remote mongo-db from a docker container at 172.17.0.1:[port], but without success. What's my mistake?
Note: I am looking for a solution that works on both Linux and Mac.