I was trying out convox.com as an alternative to Heroku (it's fantastic, btw). Convox requires apps to be in docker containers and have a handy
convox start which boots up the app using docker compose. This worked great except that I don't have mongo dockerized and my ruby app couldn't connect to the mongo instance I had running on localhost. After too many hours, a quick question in the public convox slack room fixed things.
If you have an app running inside docker contianer and you want to connect to Mongo (or Postgres or anything else) that's running on localhost, use the
0.0.0.0 ip address.
It's that simple!