-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker DNS does not resolve container address by name on user-defined network in Windows #500
Comments
@friism do you know if name resolution with compose names is supposed to work with Windows containers? |
Regarding added area labels: I used |
Yeah, it works fine: https://github.com/docker/labs/blob/master/windows/windows-containers/MultiContainerApp.md @minherz can you try without creating a custom network, and just relying on the existing NAT network? Or if you're on Windows 10 insider build, you can try the new overlay networking support: https://blogs.technet.microsoft.com/virtualization/2017/02/09/overlay-network-driver-with-support-for-docker-swarm-mode-now-available-to-windows-insiders-on-windows-10/ |
I use Windows 10, but not sure whether it is insider or official build. |
I haven't personally tested divying up the NAT network, but the docs are here: https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-networking#multiple-nat-networks My point is that this is way simpler using the overlay driver (available in Windows 10 insider builds): https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/swarm-mode#creating-an-overlay-network |
This is what I did (see step#1 in the "Steps to reproduce the behavior"). |
pinging @msabansal |
@minherz This should have worked, Not sure why this is not working. Trying it out. |
@minherz Can you please let me know what happens when you run docker run -it --net=prototype_net --name=db microsoft/nanoserver cmd and then try to ping db from another container. |
@msabansal, |
@minherz thanks for getting back and glad it is working for you. It's weird indeed. |
Ok guys, it´s been a week or two now. I had the described problem - no, or just particularly DNS alias resolution of Docker Windows containers - without a user-defined network, but just with the standard After so much time reading through all the docs (gotchas and caveeats etc.) and trying mostly anything, the only thing that helped me was just the link to https://github.com/docker/labs/blob/master/windows/windows-containers/MultiContainerApp.md with one small sentence:
And the following inserts in my Dockerfile:
It would have been really nice to have this one in the docs! Hope to save some other people a lot of time! Thanks for the link @friism anyway |
@jonashackt sorry this caused so much grief - I thought this was supposed to have been fixed in Windows |
@friism There was an issue with the update package and we fixed it in the upcoming windows patch. I thought we got it documented somewhere. |
My workaround for now involves changing the DNS servers on
|
This helps me too. |
@darkshade9 , @dyvniy how do you automate it? you cannot manually place it each time for docker build command unless the whole devops process is done manually. at least, we cannot... |
I have a Powershell script that I add via the Dockerfile
that executes the following:
|
And |
It's whatever your DNS servers are, they can be hard set or pulled from whatever service is running -- I'm not running Kubernetes because we had some issues with it integrating with our Windows containers, we're running with Portainer at the moment. We are using DNS servers hosted on our AD controllers. |
My DNS servers "do not know" about Kubernetes services. The problem was that it is impossible to resolve kubernetes services by name. It is happening because some NIC in container don't have kubernetes DNS |
@minherz I have wrote program in Python 3 with docker-py. |
My deployments are done using |
I ran into something similar with CE 18 running the official Redis:latest image as an LCOW container with Docker for windows running in windows container mode. Basically I pull the image and run it with all the defaults, I just add “-h redis”. The container starts just fine, I can ping by IP, redis is functional using IP. But if I try to resolve by the hostname (redis or whatever) it does not resolve. I am still digging into this, but so far I have not been able to resolve the issue. |
I am hitting this with CE 18 with LCOW as well. I have three containers in a compost file, two Windows and one Linux. From one if the windows container I am unable to resolve either the Windows hostname or the Linux hostname. Looking at the above solutions the changes are already in there.
Output of
|
I am hitting this exact issue with docker 17.06.02-ee-11 build 06fc007. The ServerPriorityTimeLimit is set to 0 |
I am also hitting this issue, occurs randomly. Sometimes the next time the containers/network are stood up it works, sometimes I need to restart the Docker service. Always, the service restart seems to fix it. I also tried an nslookup with the DNS and could not resolve and I don't think the ServerPriorityTimeLimit would matter because no caching would occur with an nslookup call.
|
Also seeing problems with flaky DNS resolutions against the Docker DNS resolver. Given a 3 container cluster started by compose, attaching a new container to the existing network intermittently fails to resolve DNS names of the other containers:
Note the sporadic resolutions
docker info
|
The intermittent issue I mentioned above appears to be related to a combination of LCOW and Alpine - I've filed issues at moby/libnetwork#2371 and microsoft/opengcs#303 because I'm not sure where my particular problem occurs. |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Expected behavior
A command like
ping db
wheredb
is a name of the container does not succeed returning "Ping request could not find host minio1. Please check the name and try again."Actual behavior
A command that use container name should resolve to container IP and succeed.
Information
docker version
command:Steps to reproduce the behavior
The following can be reproduced by executing
docker run
commands as well.nat
network mask is 172.25.128.0/20):The output will be something like
Using
docker run
command with--network-alias
in addition to--name
has the same effect.The text was updated successfully, but these errors were encountered: