Reach Docker Host From Container

Hold on Cowboy

This blog post is pretty old. Be careful with the information you find in here. It's likely dead, dying, or wildly inaccurate.

This is the best way I’ve found to set up for a container to contact the host machine.

sudo ifconfig lo0 alias 172.16.123.1

Now you can use the IP 172.16.123.1 to contact your local host machine. Might want to store that in an environment variable.

Note: I had written a much longer, more in-depth post, but a few unfortunate key strokes in Vim obliterated much of the post…

Did this help you out? It took me a few days to piece together all this information together, I hope this saves you some time (who knows, maybe the future me will be thankful I wrote this down). Let me know your thoughts. [email protected]