Why can't my Docker container reach a service running on localhost of the host machine? #47
Answered
by
Kevinchamplin
Kevinchamplin
asked this question in
Q&A
-
|
Why can't my Docker container reach a service running on localhost of the host machine? |
Beta Was this translation helpful? Give feedback.
Answered by
Kevinchamplin
Jun 13, 2026
Replies: 1 comment
-
|
Inside the container, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Kevinchamplin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inside the container,
localhostis the container itself, not the host — so it can't see a service bound to the host's localhost. On Docker Desktop (Mac/Windows) use the special DNS name host.docker.internal to reach the host. On Linux, add--add-host=host.docker.internal:host-gateway(or use the host network / the gateway IP).