Getting connection error when I am running Eureka server and Eureka clients

Published

This is Dockerfile for Eureka server

FROM openjdk:16-jdk-alpine
COPY target/EurekaDiscoveryService-0.0.1-SNAPSHOT.jar EurekaDiscoveryServer.jar
ENTRYPOINT ["java","-jar","EurekaDiscoveryServer.jar"]

This is Dockerfile for Eureka client

FROM openjdk:16-jdk-alpine
COPY target/ApiGateway-0.0.1-SNAPSHOT.jar ApiGateway.jar
ENTRYPOINT ["java","-jar","ApiGateway.jar"]

This is application.properties file for Eureka server

server.port=8010
spring.application.name=eureka-server
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka
eureka.instance.prefer-ip-address=true

This is application.properties for Eureka client

server.port=8082
spring.application.name=api-gateway
eureka.client.service-url.defaultZone=http://127.0.0.1:8010/eureka

I am using

-docker run -d -p 8010:8010 eurekaserver command to run Eureka server 
-docker run -p 8082:8082 apigateway command to run Eureka client

I am getting following error

 Request execution failed with message: I/O error on GET request for
 "http://localhost:8010/eureka/apps/": Connect to localhost:8010
 [localhost/127.0.0.1] failed: Connection refused; nested exception
 is org.apache.http.conn.HttpHostConnectException: Connect to
 localhost:8010 [localhost/127.0.0.1] failed: Connection refused

Source: Docker Questions

Published
Categorised as docker, java, microservices, netflix-eureka Tagged , , ,

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq