docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.87k stars 291 forks source link

Unable to connect to grpc service from Windows #13283

Open Phan-Tom416 opened 1 year ago

Phan-Tom416 commented 1 year ago

Actual behavior

Cannot connect to a grpc service from Windows, but connecting from a different container to it works

Expected behavior

Should be able to connect to grpc service

Information

Output of & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0002: does the bootloader have virtualization enabled?
[SKIP] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0022: is the Virtual Machine Platform Windows Feature enabled?
[PASS] DD0021: is the WSL 2 Windows Feature enabled?
[PASS] DD0024: is WSL installed?
[PASS] DD0025: are WSL distros installed?
[PASS] DD0026: is the WSL LxssManager service running?
[PASS] DD0029: is the WSL 2 Linux filesystem corrupt?
[PASS] DD0035: is the VM time synchronized?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0031: does the Docker API work?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0003: is the Docker CLI working?
[PASS] DD0005: is the user in the docker-users group?
[PASS] DD0038: is the connection to Docker working?
[PASS] DD0014: are the backend processes running?
[PASS] DD0007: is the backend responding?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[PASS] DD0006: is the Docker Desktop Service responding?
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0033: does the host have Internet access?
[PASS] DD0002: does the bootloader have virtualization enabled?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0022: is the Virtual Machine Platform Windows Feature enabled?
[PASS] DD0021: is the WSL 2 Windows Feature enabled?
[PASS] DD0024: is WSL installed?
[PASS] DD0025: are WSL distros installed?
[PASS] DD0026: is the WSL LxssManager service running?
[PASS] DD0029: is the WSL 2 Linux filesystem corrupt?
[PASS] DD0035: is the VM time synchronized?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0031: does the Docker API work?
[PASS] DD0032: do Docker networks overlap with host IPs?
No fatal errors detected.

Steps to reproduce the behavior

  1. diambra run cmd.exe
discordianfish commented 1 year ago

I've worked with @Phan-Tom416 to investigate this issue, here is what we found so far:

Investigation

There seems to be an issue with the portmapping. We tried to reproduce this with nginx but couldn't:

But binding the hostport to 127.0.0.1 makes it unreachable. On my windows machine this works so I suspect this points already to some issue:

To rule out the container port <-> vm port mapping as the problem we tried running with host networking:

Finally to show that it's not an issue with our grpc server itself, we ran grpcurl from another linked container which was successful:

Conclusion

There seems to be two related? issues:

More discussion/details also in diambra/arena#62

jtnord commented 1 year ago

binding any port on 127.0.0.1 makes it unreachable from the windows host

I am seeing what appears to be exactly this behaviour to. binding to 127.0.0.2 as a workaround (-p 127.0.0.2:xxx:xxx) works (the port is reachable from windows and also not exposed on all public interfaces!)

Information Windows Version: Windows 11 22H1 (22000.1761) Docker Desktop Version: v4.18.0 WSL2 or Hyper-V backend? WSL2 (1.1.6.0)