Search code examples
spring-cloud

Services are registered with Eureka but not accessable from browser because of DNS_PROBE_FINISHED_NXDOMAIN


When I register a service with Eureka I can go to Eureka url http://localhost:8761/ and see that it's up:

RANDOM-ANIMAL n/a (1) (1) UP (1) - host.docker.internal:random-animal:8082

Then I open RANDOM-ANIMAL in browser http://random-animal/random and see an error:

DNS_PROBE_FINISHED_NXDOMAIN

What can be the cause of this problem?

P.S.

It worked some time ago but something changed on PC and I can't fix it now.


Solution

  • random-animal is not a known hostname outside of docker, but if you expose port 8082, you can make it available on localhost, so make sure you map the port 8082 when you start the container (-p 8082:8082).

    You can additionally map random-animal to 127.0.0.1 in your hosts file so that you can use that host too if you want.