How to work around docker-compose DNS issue with docker on windows
By: Date: 31 March 2017 Categories: Docker Tags: , , ,

Based on this compose file the web tier should be able to resolve the database by the network name db and the db should be able to resolve the web tier by the name web.

Unfortunately at the moment there is a bug that should be fixed soon. the work around this at the moment is as follows:

in the docker files where you build your containers, you need to add the following statement:

You need to add this line to each container that needs to reach out on the network and find the other container when using the NAT network.

So in case of my example this needs to be added to the Docker file of the web application, since it will go out and try to reach the database.

Hopefully this will be fixed soon, but in the meanwhile this can help you make things work.

One thought on “How to work around docker-compose DNS issue with docker on windows

  1. Awesome, thank you so much! I’ve been puzzled for the whole day why my containers cannot connect to each other. First they were working, but suddenly everything stopped. You can imagine my reaction since I just had set up the environment in Azure and then this happened.

    Also it might be worth mentioning that I got confirmation from MS that the fix should be included in April’s monthly updates.

Leave a Reply

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