title: Spring Boot Docker com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
body: <p>this is my Eureka Server <strong>application.property</strong></p>
  <pre><code># set port
  server.port=8761
  # no need to register the server with the server
  eureka.client.register-with-eureka=false
  # don't need a local copy of the registry
  eureka.client.fetch-registry=false
  </code></pre>
  <p>Eureka Server <em>dockerfile</em></p>
  <pre><code>FROM openjdk:8
  ADD target/eureka-service.jar eureka-service.jar
  EXPOSE 8761
  ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;eureka-service.jar&quot;]
  </code></pre>
  <p>Eureka Client <em>application.property</em></p>
  <pre><code>eureka.client.serviceUrl.defaultZone= http://localhost:8761/eureka/
  eureka.client.registerWithEureka=true
  eureka.client.fetchRegistry=true
  </code></pre>
  <p>Eureka Client <em>dockerfile</em></p>
  <pre><code>FROM openjdk:8
  ADD target/foo.jar foo.jar
  EXPOSE 8971
  ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;foo.jar&quot;]
  </code></pre>
  <p>Eureka server is annotated with <em>@EnableEurekaServer</em> and Eureka client is annotate with <em>@EnableEurekaClient</em></p>
  <p>The client is successfully registered with EurekaServer and everything is working fine. But when i try to run this in Docker using below</p>
  <h1>Docker-Compose.yml</h1>
  <p>version: &quot;2.0&quot;</p>
  <pre><code>services:
   foo-service:
    build: foo/
    ports: 
    - &quot;8761:8761&quot;
  
   bar-service:
    build: bar/
    ports: 
    - &quot;8971:8971&quot;
  </code></pre>
  <p>The client is unable to register with server. and getting below stacktrace.</p>
  <pre><code>com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
        |     at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:111) ~[eureka-client-1.6.2.jar!/:1.6.2]
        |     at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) ~[eureka-client-1.6.2.jar!/:1.6.2]
        |     at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59) ~[eureka-client-1.6.2.jar!/:1.6.2]
        |     at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) ~[eureka-client-1.6.2.jar!/:1.6.2]
        |     at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) ~[eureka-client-1.6.2.jar!/:1.6.2]
        |     at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:798) ~[eureka-client-1.6.2.jar!/:1.6.2]
        |     at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:104) [eureka-client-1.6.2.jar!/:1.6.2]
        |     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_171]
        |     at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_171]
        |     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_171]
        |     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_171]
        |     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171]
        |     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171]
        |     at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
  </code></pre>
  <p>I am really a new guy in Docker , Any help ?</p>