Curl on host.docker.internal on a specific port runs in timeout

Hey guys,

On a server i have multiple services which run in their own containers.

I have a forward proxy (Nginx Proxy Manager ( jc21/nginx-proxy-manager)) that also runs inside a container on the server.

When i send a ping to host.docker.internal from the NPM container, it works as I get a response. On the other side, when i want to execute a curl to a service on the host via host.docker.internal:, it doesn’t work.

The services have correctly exposed ports all via docker-compose.yml. I reach them from the host in the browser and verify they work.

I mount host.docker.internal via

extra_hosts:
  - "host.docker.internal:host-gateway"

Why am I able to ping host.docker.internal from within the container but curl to a specific port on that host does not work? Any ideas?

Thanks in advance! :slightly_smiling_face:

1 Like

Hey dude,

You probably won’t like my answer, but: Did you check the firewall rules. Had a similiar issue and needed to open specific ports in the firewall ruleset.

Most probably this will solve your issue, give it a try.

Best regards!

1 Like

Hey man,

that really did the thing, how did i not think of that… :skull:

Thanks a lot mate! xD