Docker Community Forums

Share and learn in the Docker community.

Cannot access dotnet core container by hostname anymore

I am having DNS issues on my docker containers on Windows 10. It is really strange. I am running a microservice architecture with containers running IIS core apps. I create my containers using docker-compose. I supply hostnames so that I can access them by name without exposing ports. For instance, I want to access to web front end by writing “http://web”.

This set up used to work a while ago. However for some time now I can access them only when using Opera browser. Any other browsers or applications (e.g. Postman, ping) are oblivious to that. I need to put up IIS with URL rewrite so that the requests incoming to my front end address would be redirected to “web” microservice. When I try to access on a browser other than Opera, I simply cannot connect. When I use URL rewrite, and try to connect over IIS, I get a 502.3 - Bad Gateway. However, I can successfully rewrite my “web” container when I used the container IP rather than hostname or name of the container.

Note: The same setup, the same everything, including IIS configuration, works on my two Windows Server 2016 machines. So this looks like an Win 10 issue. Any idea what might be causing my DNS not to resolve container hostnames?

here’s the part of my compose file, nothing fancy:

    image: web
       context: ./Web/Web
       dockerfile: Dockerfile
    hostname: web

And here’s my web.config:

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://web/{R:1}" />
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                    <match filterByTags="A, Form, Img" pattern="^http(s)?://web/(.*)" />
                    <action type="Rewrite" value="http{R:1}://{R:2}" />
                    <preCondition name="ResponseIsHtml1">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />

does anyone have the solution to this problem?