I have docker installed on windows 11
I can’t ping the host machine from inside any container
Telnet from any container doesn’t connect to any port on the host machine
This was working fine for over a year now, but suddenly it stopped, I’m not sure if it was an update that caused this or what.
To keep it simple, I created a new ubuntu container with bridged network
1a6070345c6e ubuntu_default bridge local
I disabled the firewall on the host machine
I then tried to ping the host machine, with no success
> root@350629447ec5:/# ping 192.168.100.100
> PING 192.168.100.100 (192.168.100.100) 56(84) bytes of data.
> ^C
> 192.168.100.100 ping statistics --- 131 packets transmitted, 0 received, 100% packet loss, time 135229ms
Then I tried with telnet:
> root@350629447ec5:/# telnet 192.168.100.100 80
> Trying 192.168.100.100...
As I mentioned, this was working before, how can I debug and solve this issue?
2
Answers
First of all I will try to do
To show if the port is open on the container should look something like this
If this commands doesn’t show the port open try something like this
If that is not the case try to run the container in host mode instead of bridge to see difference
Also verify that your IP is similar(same octets) to what are you trying to ping check on windows with
To access the host from a container, the recommended way is to add
--add-host=host.docker.internal:host-gateway
to yourdocker run
command. Then you can use the hostnamehost.docker.internal
to access it.Like this
and then inside the container you can
(you need to install ping first if you use the debian image in my example)