Spring boot Eureka TransportException when trying discovery through docker

Published

I’ve seen a few posts about this issue, but all the ones ive seen havent had the second exception that I get. Both Eureka server and my user service are dockerized, but i get this exception every time i run my docker compose

 com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
user-service          |         at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.10.14.jar!/:1.10.14]
user-service          |         at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.sendHeartBeat(EurekaHttpClientDecorator.java:89) ~[eureka-client-1.10.14.jar!/:1.10.14]
user-service          |         at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$3.execute(EurekaHttpClientDecorator.java:92) ~[eureka-client-1.10.14.jar!/:1.10.14]
user-service          |         at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) ~[eureka-client-1.10.14.jar!/:1.10.14]
user-service          |         at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.sendHeartBeat(EurekaHttpClientDecorator.java:89) ~[eureka-client-1.10.14.jar!/:1.10.14]
user-service          |         at com.netflix.discovery.DiscoveryClient.renew(DiscoveryClient.java:893) ~[eureka-client-1.10.14.jar!/:1.10.14]
user-service          |         at com.netflix.discovery.DiscoveryClient$HeartbeatThread.run(DiscoveryClient.java:1457) ~[eureka-client-1.10.14.jar!/:1.10.14]
user-service          |         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
user-service          |         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
user-service          |         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
user-service          |         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
user-service          |         at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]

I am also getting a connection error, but StackOverflow wont let me post the stack trace because it "looks like spam"

I’m very new to docker and eureka. Here are my application properties files for both projects.

User Service

spring.data.mongodb.port=27017
spring.data.mongodb.database=User

spring.application.name=user-service
server.port=8080

eureka.client.service-url.defaultZone=http://localhost:8761/eureka/
eureka.instance.lease-renewal-interval-in-seconds=1
eureka.instance.lease-expiration-duration-in-seconds=2

Eureka Server

server.port=8761

eureka.instance.hostname=marketplace-eureka
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.service-url.defaultZone=http://localhost:8761/eureka/

Docker Compose is as follows.

version: '2'
services:
  marketplace-eureka:
    image: marketplace-eureka:1
    container_name: marketplace-eureka
    expose:
      - '8761'
  user-service:
    image: user-service:1
    container_name: user-service
    ports:
      - "8080:8080"
    environment:
      server.port: 8080
      eureka.client.enabled: 'true'
      eureka.host: marketplace-eureka
      eureka.instance.preferIpAddress: 'true'
      eureka.client.serviceUrl.defaultZone: http://marketplace-eureka:8761/eureka/

Source: Docker Questions

Published
Categorised as docker, docker-compose, java, netflix-eureka, spring-boot 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