This question is different from 'How to get the IP address of the docker host from inside a docker container' due to the fact that the IP address of the docker host could be the public IP or the private IP in the network which may or may not be reachable from within the docker container (I mean public IP if hosted at AWS or something). Is there any way to connect to this MySql or any other program on localhost from within this docker container? The MySql is running on localhost and not exposing a port to the outside world, so its bound on localhost, not bound on the ip address of the machine. So I have a Nginx running inside a docker container, I have a mysql running on localhost, I want to connect to the MySql from within my Nginx.