DEV Community


Discussion on: Access host from a docker container

gonzalo2683 profile image
Gonzalo Guevara • Edited

Could you show the example of how to allow the connection?

I have the same problem, if I try curl host.docker.internal I get
curl: (7) Failed to connect to host.docker.internal port 80: Connection refused

I am linux

Thread Thread
axcairns profile image

Been a while so I'm hazy. From memory my docker containers were running on while my LAN is on I just needed to tell ufw to allow access to that port from

Thread Thread
jamescook profile image

I had exactly the same problem.
Confusingly ping was working from the container but e.g. wget and traceroute etc. were not (a good indication of a firewall "problem").

In my set-up the solution was:

ufw allow in to proto tcp port 8084

where is the docker0 IP address and 8084 the port on the host machine.