Docker Community Forums

Share and learn in the Docker community.

Temporary no network connectivity just after windows container was created

Issue:
I notice an issue when windows container just after it is being created has no internet connection - curl or ping are failing to google.com or to our servers inside the network. After few retries containers get connection and from this point ping is successful every time.
This issue occurs only on one of windows docker hosts. Host is pinging every time, the issue occurs only within container and only just after it was created.
Host specification:
Windows Server 2019 Standard, version 1809, os build: 17763.1369
Docker Desktop 2.4.0.0 stable, Engine 19.03.13, Compose 1.27.4
Network Adapters on host:
PS C:\Windows\system32> Get-NetAdapter

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
bond0                     Microsoft Network Adapter Multiplexo...      10 Up           **        2 Gbps
vEthernet (Ethernet)                                                   38 Up          **        10 Gbps
Ethernet                  Intel(R) I350 Gigabit Network Connec...       9 Up           **         1 Gbps
Ethernet 2                Intel(R) I350 Gigabit Network Conn...#2       7 Up           **         1 Gbps
vEthernet (nat)           Hyper-V Virtual Ethernet Adapter             11 Up           **       10 Gbps

Steps to reproduce
Build container on servercore image and ping 10 times google. com.
Run.bat file:

FOR /L %%A IN (1,1,10) DO ( curl --retry 5 -v --fail http://google.com )
Dockerfile:
FROM mcr.microsoft. com/windows/servercore:1809
COPY run.bat .
RUN “run.bat”

and with that run "docker build"command in loop to create container, ping 10 times google from within the container, kill container and run it again. Example how i’m doing it from Jenkinsfile:

timeout(time: 1, unit: ‘HOURS’) {

node(“problematicWindowsHost”) {

while (true) {

docker.build(“pinger”, “-f Dockerfile --no-cache .”)

sleep time: 1, unit: ‘SECONDS’

}

}

}

Results:
While running that for 1 hour, ocassionally first curl command will fail and after 2 retries it will succeed. It’s worth to mention that when im pinging google directly from host every 1 second in a loop, it works every time, for couple of hours straight. The issue ONLY appears from within the windows container.

Strange thing is we have 2 other machines with the same OS and the same Docker Desktop version (different hardware) and we also tested it there, and the issue does not appear. I think it’s some correlation between multiple network adapters and the way network is being handled by Docker Desktop. I’m looking for solution :slight_smile: