title: Spring Cloud Gateway not Working on Docker
body: <p>I have configured a spring cloud gateway to redirect to a server a created with the following route:</p>
  <pre><code>@Bean
  public RouteLocator myRoutes(RouteLocatorBuilder builder) {
      return builder.routes()
              .route(p -&gt; p
                      .path(&quot;/v1/**&quot;)
                      .uri(&quot;lb://data-diff-service&quot;))
              .build();
  }
  </code></pre>
  <p>It works fine on a local environment, but when I start my services containers through my docker-compose file, the gateway is not able to find the customer-service.
  It works fine when running locally outside the containers</p>
  <p><a href="https://i.stack.imgur.com/UoBDL.png" rel="nofollow noreferrer">my docker-compose file</a></p>
  <pre><code>version: &quot;3.4&quot;
  services:
    registry-service:
      image:  project/registry-service
      hostname: registry-service
      ports:
        - &quot;8761:8761&quot;
  
    gateway:
      image: project/gateway
      hostname: gateway
      ports:
        - &quot;8080:8080&quot;
      environment:
        EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://registry-service:8761/eureka
  
    data-diff-service:
      image: project/data-diff-service
      hostname: data-diff-service
      environment:
        EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://registry-service:8761/eureka
        SPRING_DATA_MONGODB_URI: mongodb://teste:teste@mongo-database:27017/data_diff?retryWrites=true&amp;w=majority
  </code></pre>
  <p>I'm testing it on the localhost 8080 port.
  The data-diff-service can communicate normally with Mongo db that runs in a separate container</p>
  <p><strong>EDIT</strong>
  result from http://:8761/eureka/apps:</p>
  <pre><code>&lt;applications&gt;
    &lt;versions__delta&gt;1&lt;/versions__delta&gt;
    &lt;apps__hashcode&gt;UP_2_&lt;/apps__hashcode&gt;
    &lt;application&gt;
      &lt;name&gt;GATEWAY&lt;/name&gt;
      &lt;instance&gt;
        &lt;instanceId&gt;gateway:localhost:2ba2ecb7caf0931ba4b5580138cd3817&lt;/instanceId&gt;
        &lt;hostName&gt;localhost&lt;/hostName&gt;
        &lt;app&gt;GATEWAY&lt;/app&gt;
        &lt;ipAddr&gt;172.20.0.4&lt;/ipAddr&gt;
        &lt;status&gt;UP&lt;/status&gt;
        &lt;overriddenstatus&gt;UNKNOWN&lt;/overriddenstatus&gt;
        &lt;port enabled=&quot;true&quot;&gt;8080&lt;/port&gt;
        &lt;securePort enabled=&quot;false&quot;&gt;443&lt;/securePort&gt;
        &lt;countryId&gt;1&lt;/countryId&gt;
        &lt;dataCenterInfo class=&quot;com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo&quot;&gt;
          &lt;name&gt;MyOwn&lt;/name&gt;
        &lt;/dataCenterInfo&gt;
        &lt;leaseInfo&gt;
          &lt;renewalIntervalInSecs&gt;30&lt;/renewalIntervalInSecs&gt;
          &lt;durationInSecs&gt;90&lt;/durationInSecs&gt;
          &lt;registrationTimestamp&gt;1615821410991&lt;/registrationTimestamp&gt;
          &lt;lastRenewalTimestamp&gt;1615821560153&lt;/lastRenewalTimestamp&gt;
          &lt;evictionTimestamp&gt;0&lt;/evictionTimestamp&gt;
          &lt;serviceUpTimestamp&gt;1615821410308&lt;/serviceUpTimestamp&gt;
        &lt;/leaseInfo&gt;
        &lt;metadata&gt;
          &lt;management.port&gt;8080&lt;/management.port&gt;
        &lt;/metadata&gt;
        &lt;homePageUrl&gt;http://localhost:8080/&lt;/homePageUrl&gt;
        &lt;statusPageUrl&gt;http://localhost:8080/actuator/info&lt;/statusPageUrl&gt;
        &lt;healthCheckUrl&gt;http://localhost:8080/actuator/health&lt;/healthCheckUrl&gt;
        &lt;vipAddress&gt;gateway&lt;/vipAddress&gt;
        &lt;secureVipAddress&gt;gateway&lt;/secureVipAddress&gt;
        &lt;isCoordinatingDiscoveryServer&gt;false&lt;/isCoordinatingDiscoveryServer&gt;
        &lt;lastUpdatedTimestamp&gt;1615821410991&lt;/lastUpdatedTimestamp&gt;
        &lt;lastDirtyTimestamp&gt;1615821410126&lt;/lastDirtyTimestamp&gt;
        &lt;actionType&gt;ADDED&lt;/actionType&gt;
      &lt;/instance&gt;
    &lt;/application&gt;
    &lt;application&gt;
      &lt;name&gt;DATA-DIFF-SERVICE&lt;/name&gt;
      &lt;instance&gt;
        &lt;instanceId&gt;data-diff-service:localhost:2477c80c3a1b51f6af76fc02013be957&lt;/instanceId&gt;
        &lt;hostName&gt;localhost&lt;/hostName&gt;
        &lt;app&gt;DATA-DIFF-SERVICE&lt;/app&gt;
        &lt;ipAddr&gt;172.20.0.5&lt;/ipAddr&gt;
        &lt;status&gt;UP&lt;/status&gt;
        &lt;overriddenstatus&gt;UNKNOWN&lt;/overriddenstatus&gt;
        &lt;port enabled=&quot;true&quot;&gt;37069&lt;/port&gt;
        &lt;securePort enabled=&quot;false&quot;&gt;443&lt;/securePort&gt;
        &lt;countryId&gt;1&lt;/countryId&gt;
        &lt;dataCenterInfo class=&quot;com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo&quot;&gt;
          &lt;name&gt;MyOwn&lt;/name&gt;
        &lt;/dataCenterInfo&gt;
        &lt;leaseInfo&gt;
          &lt;renewalIntervalInSecs&gt;30&lt;/renewalIntervalInSecs&gt;
          &lt;durationInSecs&gt;90&lt;/durationInSecs&gt;
          &lt;registrationTimestamp&gt;1615821441412&lt;/registrationTimestamp&gt;
          &lt;lastRenewalTimestamp&gt;1615821441412&lt;/lastRenewalTimestamp&gt;
          &lt;evictionTimestamp&gt;0&lt;/evictionTimestamp&gt;
          &lt;serviceUpTimestamp&gt;1615821440902&lt;/serviceUpTimestamp&gt;
        &lt;/leaseInfo&gt;
        &lt;metadata class=&quot;java.util.Collections$EmptyMap&quot;/&gt;
        &lt;homePageUrl&gt;http://localhost:37069/&lt;/homePageUrl&gt;
        &lt;statusPageUrl&gt;http://localhost:37069/actuator/info&lt;/statusPageUrl&gt;
        &lt;healthCheckUrl&gt;http://localhost:37069/actuator/health&lt;/healthCheckUrl&gt;
        &lt;vipAddress&gt;data-diff-service&lt;/vipAddress&gt;
        &lt;secureVipAddress&gt;data-diff-service&lt;/secureVipAddress&gt;
        &lt;isCoordinatingDiscoveryServer&gt;false&lt;/isCoordinatingDiscoveryServer&gt;
        &lt;lastUpdatedTimestamp&gt;1615821441412&lt;/lastUpdatedTimestamp&gt;
        &lt;lastDirtyTimestamp&gt;1615821440865&lt;/lastDirtyTimestamp&gt;
        &lt;actionType&gt;ADDED&lt;/actionType&gt;
      &lt;/instance&gt;
    &lt;/application&gt;
  &lt;/applications&gt;
  </code></pre>
  <p>I've lost a day on it, could anyone help?</p>