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 was the way to access my developer machine. It works for a MacOs.

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.