title: Service discovery with eureka is not working in docker container
body: <p>When I run my API gateway in docker container then it is not able to find my services which are registered in eureka.</p>
  
  <p><strong>API Gateway</strong></p>
  
  <p>-- ocelot.json</p>
  
  <pre><code>{
    "ReRoutes": [
      {
        "DownstreamPathTemplate": "/api/values",
        "DownstreamScheme": "http",
        "UseServiceDiscovery": true,
        "ServiceName": "sampleservice",
        "UpstreamPathTemplate": "/sample-api/{catchAll}"
      }
    ],
    "GlobalConfiguration": {
      "UseServiceDiscovery": true,
      "ServiceDiscoveryProvider": {
        "Type": "Eureka",
        "Host": "myeurekaserver",
        "Port": "8761"
      }
    }
  }
  </code></pre>
  
  <p><strong>--</strong> appsettings.json  for API Gateway</p>
  
  <pre><code>{
    "eureka": {
      "client": {
        "shouldRegisterWithEureka": false,
        "serviceUrl": "http://myeurekaserver:8761/eureka/",
        "ValidateCertificates": false
      },
      "instance": { 
        "appName": "gateway",
        "hostName": "myeurekaserver", 
        "port": "7000"
      }
    }
  }
  </code></pre>
  
  <p><strong>Service Configuration --appsettings.json</strong></p>
  
  <pre><code>{
    "eureka": {
      "client": {
        "shouldRegisterWithEureka": true,
        "serviceUrl": "http://myeurekaserver:8761/eureka/",
        "ValidateCertificates": false
      },
      "instance": {
        "appName": "sampleservice",
        "hostName": "myeurekaserver",
        "port": "7001"
      }
    }
  }
  </code></pre>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>version: '3.4'
  
  services:
    sampleapi:
      image: ${DOCKER_REGISTRY-}sampleapi
      ports:
        - "7001:80"
      networks:
        - ecnetwork
      build:
        context: .
        dockerfile: SampleAPI/Dockerfile
  
    gateway:
      image: ${DOCKER_REGISTRY-}gateway
      ports:
        - "7000:80"
      networks:
        - ecnetwork
      build:
        context: .
        dockerfile: Gateway/Dockerfile
  
  
    myeurekaserver:
      image: ${DOCKER_REGISTRY-}myeurekaserver
      ports:
        - "8761:8761"
      networks:
        - ecnetwork
      build:
        context: .
        dockerfile: MyEurekaServer/Dockerfile
  
  networks:
    ecnetwork:
      external: true
  </code></pre>
  
  <p>When I run command docker-compose up and check on <a href="http://localhost:8761/" rel="nofollow noreferrer">http://localhost:8761/</a> I find my services have been registred in the eureka server, but I run <code>http://localhost:7000/sample-api/order</code>
  It returns </p>
  
  <blockquote>
    <p>localhost is currently unable to handle this request. HTTP ERROR 500</p>
  </blockquote>
  
  <p>I checked my console window, then It is API gateway is able to discover the services, here is the log.</p>
  
  <pre><code>gateway_1     | dbug: Steeltoe.Discovery.Eureka.DiscoveryClient[0]
  gateway_1     |       FetchRegistryDelta returned: OK
  gateway_1     | dbug: Steeltoe.Discovery.Eureka.DiscoveryClient[0]
  gateway_1     |       FetchRegistry succeeded
  </code></pre>