Accessing your local machine from a Docker container

A small entry about Docker. I am using Docker mostly in development to have one Docker per web application I am running. It gives me the advantage to have different instances of Apache running that are isolated. A few time ago, I wanted to perform an HTTP request from inside the Docker container back to my development machine — I could not. I was hitting 503.

Docker’s localhost is not my machine localhost. After some research, I found that using the DNS docker.for.mac.host.internal was the way to access my developer machine. It works for a MacOs.