Ping using domain names does not work from within docker containers on Windows 10

Viewed 71

I created a Windows docker container (PHP image) using Docker for Desktop on Windows and built it successfully

I connected to container and am able to ping Docker host and google by their IPs but not by their names

Ping to Docker host (magic variable)

PS C:\> ping host.docker.internal
Ping request could not find host host.docker.internal. Please check the name and try again

Ping to Google by Name

PS C:\> ping google.com
Ping request could not find host google.com. Please check the name and try again

Ping to Google by IP

PS C:\> ping 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=23ms TTL=115
Reply from 8.8.8.8: bytes=32 time=24ms TTL=115
Reply from 8.8.8.8: bytes=32 time=27ms TTL=115
Reply from 8.8.8.8: bytes=32 time=29ms TTL=115

Kindly note that my docker container and host are both on Windows and I cannot use --network=host as it's not supported on Windows

0 Answers
Related