title: Call Curl to Get Response from another Docker Container Service
body: <p>I have two separate docker container services. Their container are as follows:</p>
  
  <pre><code>CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                      NAMES
  6fb658bc7acd        api1                     "/bin/sh -c 'gunicor…"   5 minutes ago       Up 5 minutes        0.0.0.0:8000-&gt;8000/tcp      api1
  c57ac1b45c90        api2                     "python3 api.py"         5 minutes ago       Up 5 minutes        0.0.0.0:5000-&gt;5000/tcp    api2
  </code></pre>
  
  <p>I am writing code in api1, trying to make a call to api2 using <code>pycurl</code> as follows:</p>
  
  <pre><code>c = pycurl.Curl()
  c.setopt(c.URL, "http://0.0.0.0:5000/"+info)
  c.setopt(c.WRITEDATA, buffer)
  c.perform()
  </code></pre>
  
  <p>I was able to fetch data if I were to run this file along, but whenever I put api1 as a docker container, I am always getting empty reply from <code>curl "http://localhost:8000/...</code>. Am I setting my ports wrong? Any help would be appreciated. Thanks.</p>
  
  <pre><code>version: '2'
  services:
    api2:
      build:
      image: "api2"
      ports:
        - "5000:5000"
    api1:
      build: .
      image: "api1"
      ports:
        - "8000:8000"
  </code></pre>
  
  <p>Also, my <code>docker-compose.yml</code> file looks as follows:</p>