title: Problem with docker containers communication with port redirection
body: <p>So my structure contains 3 apps , 2 servers and 1 client, all in docker containers.</p>
  <p>I have no problem communicating with my server containers &quot;manually&quot; (from my UNcontainerized client)</p>
  <p><a href="https://i.stack.imgur.com/Trobx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Trobx.png" alt="THIS WORKS" /></a></p>
  <p>But once my client is containerized I can't communicate with the server with port redirection.</p>
  <p><a href="https://i.stack.imgur.com/ZnVqI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZnVqI.png" alt="THIS DOESNT WORK" /></a></p>
  <p>I get an <strong>Error: connect ECONNREFUSED</strong></p>
  <p>Here is my docker-compose :</p>
  <pre><code>  client:
      build: ./api-img2txt
      expose:
      - &quot;4000&quot;
      networks:
      - portfolio-network
      container_name: api-img2txt
  #####################################################
  ###################Models############################
  #####################################################
  
    tfserv-1:
      image: tensorflow/serving
      environment:
      - MODEL_NAME=sentimentAnalysis
      ports:
      - &quot;8400:8500&quot;
      - &quot;8401:8501&quot;
      networks:
      - portfolio-network
      container_name: tfserv-1
      volumes:
      - /home/flo/portfolio/api-sentimentAnalysis/sentimentanalysis/model:/models/sentimentAnalysis
      
    tfserv-2:
      image: tensorflow/serving
      environment:
      - MODEL_NAME=lineCounting
      ports:
      - &quot;8500:8500&quot;
      - &quot;8501:8501&quot;
      networks:
      - portfolio-network
      container_name: tfserv-2
      volumes:
      - /home/flo/portfolio/api-img2txt/models/lineCounting:/models/lineCounting 
  
  networks:
    portfolio-network:
  </code></pre>
  <p>This is what my client does :</p>
  <pre><code>import requests
  
  URL = &quot;http://localhost:8501/v1/models/lineCounting:predict&quot;
  json_request = '{ &quot;instances&quot; : [0] }'
  r = requests.post(url=URL, data=json_request)
  print('req1',r.json())
  print('**********')
  
  URL = &quot;http://localhost:8401/v1/models/sentimentAnalysis:predict&quot;
  json_request = '{ &quot;instances&quot; : [0] }'
  r = requests.post(url=URL, data=json_request)
  print('req2',r.json())
  
  </code></pre>
  <p>I can't change the final port, it must be 8501. How can I make my client communicate with the server on 8401 ? Thank you in advance for your help.</p>