I’m having a major headache with Docker at the moment. Windows containers randomly stop being able to resolve each other by ID or name (they can communicate via their IPs), and I randomly stop being able to access their exposed ports on the host. I’m pretty sure it’s a NAT issue. I’m currently running the edge release (19.03.0-rc2) of Docker, and Windows 10 1903.
Sometimes rebooting docker fixes it, sometimes rebooting my laptop fixes it, sometimes the only fix seems to be stopping the service and manually deleting all the folders in C:\programdata\Docker\containers.
Sleeping/waking the laptop seems to often trip this problem from what I can tell.
For example, if I create an ASP.NET container running IIS:
docker run --name aspnet1 -p 8001:80 mcr.microsoft.com/dotnet/framework/aspnet
I can’t talk to it:
telnet localhost 8001 Connecting To localhost...Could not open connection to the host, on port 8001: Connect failed
If I inspect the container I can see its NAT IP is 172.21.60.104, which is from the Hyper-V “nat” adapter, I can’t ping this or telnet to it either. When everything’s working I am able to ping/telnet to it.
If I run ipconfig on the container to get its internal IP (
docker exec -it aspnet1 ipconfig) I can see it’s 192.168.181.198, which is from the Hyper-V “default switch” adapter. Pinging/telnetting to this IP (on port 80) works fine still.
Running Linux based containers whilst in “Windows containers” mode seems to always work, I can access http://localhost:8000 here:
docker run --name nginx1 -p 8000:80 nginx
And I can do container -> container communication too:
docker run -it --rm bash ping nginx1 PING nginx1 (172.21.61.237): 56 data bytes 64 bytes from 172.21.61.237: seq=0 ttl=64 time=0.921 ms
Can anyone help?
It’s causing me major amounts of wasted time at the moment. I can’t see anything of relevance in any of the logs I’ve looked at, but I’m also not entirely sure if I’m looking in the right place so any suggestions would be great.