Troubleshooting Docker to Host communication

Docker would not blockk it, but you can check if you have any firewall enabled on Debian. You can also test another command like this running on the host:

python3 -m http.server --bind 0.0.0.0 9999

And run a container with curl and access it like:

docker run --rm -it --add-host host.docker.internal:host-gateway nicolaka/netshoot

and

curl host.docker.internal:9999

If it doesn’t work, stay in the container and run:

ip a

and

cat /etc/hosts

So check the interfaces in the container and the IP of host.docker.internal in the hosts file.

Using the nicolaka/netshoot image you can run other network debug tools too.

1 Like