Docker Linux Containers on Windows – could not determine link-layer address / rejecting access to file using non-canonical name

Problem:

When running simple webservice application in Linux Container on Docker for Desktop in Windows 10, the service is unable to pull data from an external database on the same network. This same project running in Windows Containers in Docker Desktop works as expected.

Dev machine:
Windows 10 – Version 10.0.19041 Build 19041
Docker for Desktop 2.3.0.5 (stable)<
Linux containers switched on in Docker Desktop
(Tried using either HyperV – DockerDesktopVM and WSL2 with Ubuntu)
Visual Studio 2019 building Docker compose files
VPN’d into network where SQLserver resides

When trying to access http://localhost:32768/api/dog/2 via Edge Browser I just get "waiting…." Nothing loads..

I set a breakpoint on my controller at this line:

var dog = await _context.dog.FindAsync(id);

and try to step into it or catch an exception connecting to the database but one is never produced. Website gets stuck at trying to connect…

C:Users[user]AppDataLocalDockerlog shows the following:

[20:31:37.685][VpnKit ][Warning] vpnkit.exe: ARP table has no entry for 172.20.0.2
[20:31:37.685][VpnKit ][Info ] vpnkit.exe: IP.output: could not determine link-layer address for local network (0.0.0.0/0) ip 172.20.0.2
[20:31:37.685][VpnKit ][Warning] vpnkit.exe: Could not find 172.20.0.2 on the local network
[20:31:58.517][GoBackendProcess ][Info ] rejecting access to file using non-canonical name microsoft.codeanalysis.csharp.expressionevaluator.expressioncompiler.ni.dll (canonical name is Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler.ni.dll)
[20:31:58.518][GoBackendProcess ][Info ] rejecting access to file using non-canonical name microsoft.codeanalysis.csharp.expressionevaluator.expressioncompiler.ni.dll (canonical name is Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler.ni.dll)

….edited for brevity…lots of these rejecting access messages

[20:32:30.931][VpnKit ][Warning] vpnkit.exe: ARP table has no entry for 172.20.0.2
[20:32:30.931][VpnKit ][Info ] vpnkit.exe: IP.output: could not determine link-layer address for local network (0.0.0.0/0) ip 172.20.0.2
[20:32:30.931][VpnKit ][Warning] vpnkit.exe: Could not find 172.20.0.2 on the local network
[20:32:30.931][VpnKit ][Warning] vpnkit.exe: Error sending TCP packet via IP: no route to destination: no response for IP on local network

172.20.0.2 is the Docker container IPv4Address.

192.168.65 is the subnet defined in Docker Resource settings in Docker Desktop.

After some time this appears in the log:

1:20.846][VpnKit ][Warning] vpnkit.exe: TCP 192.168.65.3:40000 > [IP of external sqlserver]:1433 closing flow due to idle port disconnection
[20:41:20.851][VpnKit ][Warning] vpnkit.exe: TCP 192.168.65.3:39990 > [IP of external sqlserver]:1433 closing flow due to idle port disconnection
[20:41:20.852][VpnKit ][Warning] vpnkit.exe: TCP 192.168.65.3:39964 > [IP of external sqlserver]:1433 closing flow due to idle port disconnection

Using wireshark I can see UDP to the external SQL server and an ACK back, and I can ping the SQLserver from within the container running the app that should be connecting to it. But nada. No data is ever returned to the controller.

I get this same result whether or not I run the HyperV VM or WSL2 using Ubuntu.

I build this same project using Docker Compose but for Windows, switch Docker to Desktop to Windows Containers and I’m golden. Simple back and forth happens and I get data back in the browser.

Anyone know what I might be missing here or have misconfigured in my implementation? Happy to provide more log/code examples.

Thanks!

Source: Docker Questions