To make a service running in a container interact with another one running locally at let's say localhost:3000
, we can use host.docker.internal:3000
in the container code to make the required connection. But is there a way I can get rid of the port while using host.docker.internal
so that it automatically routes to localhost:3000
? That is, I just use host.docker.internal
in my code instead of host.docker.internal:3000
?
Clarification: I am not asing how to connect to localhost from inside the container. What I am asking is how to route host.docker.internal
to the correct port without specifying it explicitly like: host.docker.internal:3000
.