I think the example I used might have been a bit unclear. The service you'd be using would have a port for it on the localhost. For example let's say your backend is running at localhost:3000. Then you can use host.docker.internal:3000 in the code present in your container.
What I mean to say is that the serivce would be running at a port on localhost so you would have to necessarily specify the port while using host.docker.internal. The /serivce I used might be a bit confusing cause it is the service it self which is actually running on localhost:8000 and not on localhost:8000/service.
The default port is 80. If you can get your service to run on that then you would simply be able to use host.docker.internal. Otherwise I don't think so you can get by without specifying the port since your service operates on a specific port itself.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think the example I used might have been a bit unclear. The service you'd be using would have a port for it on the localhost. For example let's say your backend is running at
localhost:3000
. Then you can usehost.docker.internal:3000
in the code present in your container.What I mean to say is that the serivce would be running at a port on localhost so you would have to necessarily specify the port while using
host.docker.internal
. The/serivce
I used might be a bit confusing cause it is the service it self which is actually running onlocalhost:8000
and not onlocalhost:8000/service
.I understood, but what I meant is how can we get rid the port
The default port is 80. If you can get your service to run on that then you would simply be able to use
host.docker.internal
. Otherwise I don't think so you can get by without specifying the port since your service operates on a specific port itself.