title: How to correctly set up docker network to use localhost connection?
body: <p>I have two services. Service A calls service B like this:</p>
  
  <pre><code>HttpGet request = new HttpGet("http://127.0.0.1:8083/getTest");
  HttpResponse httpResponse = httpClient.execute(request);
  </code></pre>
  
  <p>I have the <strong>error</strong>:</p>
  
  <pre><code>There was an unexpected error (type=Internal Server Error, status=500).
  Connect to 127.0.0.1:8083 [/127.0.0.1] failed: Connection refused: connect
  </code></pre>
  
  <p>This is <strong>docker ps output</strong>:</p>
  
  <pre><code>CONTAINER ID        IMAGE        COMMAND               CREATED             STATUS              PORTS                    NAMES
  2a8eaf08881a        service_A    "./gradlew bootRun"   5 seconds ago       Up 4 seconds        0.0.0.0:80-&gt;80/tcp       service_A
  b7436a77e438        service_B    "go-wrapper run"      About an hour ago   Up 4 seconds        0.0.0.0:8083-&gt;8083/tcp   service_B
  </code></pre>
  
  <p>I created <strong>docker network</strong>:</p>
  
  <pre><code>docker network create webproxy
  </code></pre>
  
  <p>My <strong>docker-compose.yml</strong> is:</p>
  
  <pre><code>version: '3'
  services:   
    service_A:
      container_name: service_A
      build: ./service_A
      hostname: service_A
      restart: always
      ports:
        - "8083:8083"
  
    service_B:
      container_name: service_B
      build: ./service_B
      hostname: service_B
      restart: always
      ports:
        - "80:80"     
  
  networks:
    default:
      external:
        name: webproxy
  </code></pre>
  
  <p>This is container's <strong>ip addr show eth0</strong>:</p>
  
  <pre><code>project$ docker exec -it 2a8eaf08881a ip addr show eth0
  68: eth0@if69: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP group default
      link/ether 02:42:ac:13:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
      inet 172.19.0.2/16 scope global eth0
         valid_lft forever preferred_lft forever
  
  
  project$ docker exec -it b7436a77e438 ip addr show eth0
  66: eth0@if67: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP group default
      link/ether 02:42:ac:13:00:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
      inet 172.19.0.3/16 scope global eth0
         valid_lft forever preferred_lft forever
  </code></pre>
  
  <p>This is <strong>docker network</strong> information:</p>
  
  <pre><code>project$ docker network ls
  NETWORK ID          NAME                DRIVER              SCOPE
  9fcac7636448        bridge              bridge              local
  83a0f3fe901d        host                host                local
  215ab1608f91        none                null                local
  95909545832d        predictor_default   bridge              local
  be19665e791d        webproxy            bridge              local
  </code></pre>
  
  <p>Also I can ping <strong>172.19.0.3</strong> from containers. </p>
  
  <p>How to correctly to communicate between service A and service B?</p>