Answer the question
In order to leave comments, you need to log in
Accessing localhost from docker container?
I'm really bad at everything so just tell me what to write in docker-compose so that the container can access localhost:8080 on the machine itself
Thanks a lot!
Answer the question
In order to leave comments, you need to log in
You will have to remove isolation from the network , otherwise you will not be able to access localhost on the host machine from the container.
Or, you can make the service on the host machine listen on all interfaces and access it from the container at the gateway address in the virtual network to which the container is connected.
Add to docker-compose
extra_hosts:
- "host.docker.internal:host-gateway"
host.docker.internal:8080
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question