title: docker-compose succeed but server does not response when request
body: <p>I have built a RESTful API web service using <strong>Flask</strong> framework, <strong>Redis</strong> as main database, <strong>MongoDB</strong> as a backup store and <strong>Celery</strong> as task queue to store data into MongoDB in background</p>
  
  <p>Then I dockerize my application using <strong>docker-compose</strong>. Here is my <code>docker-compose.yml</code>:</p>
  
  <pre><code>version: '3'
  
  services:
    web:
      build: .
      ports:
        - "5000:5000"
      volumes:
        - .:/app
    redis:
      image: "redis:alpine"
      ports:
        - "6379:6379"
    mongo:
      image: "mongo:3.6.5"
      ports:
        - "27017:27017"
      environment:
        MONGO_INITDB_DATABASE: syncapp
  </code></pre>
  
  <p>Here is my <code>Dockerfile</code>:</p>
  
  <pre><code># base image
  FROM python:3.5-alpine
  MAINTAINER xhoix &lt;145giakhang@gmail.com&gt;
  
  # copy just the requirements.txt first to leverage Docker cache
  # install all dependencies for Python app
  COPY ./requirements.txt /app/requirements.txt
  
  WORKDIR /app
  
  # install dependencies in requirements.txt
  RUN pip install -r requirements.txt
  
  # copy all content to work directory /app
  COPY . /app
  
  # specify the port number the container should expose
  EXPOSE 5000
  
  # run the application
  CMD ["python", "/app/app.py"]
  </code></pre>
  
  <p>After run command <code>docker-compose up</code>, the app server, Redis and Mongo server just run well. But when I use <strong>Postman</strong> or <strong>curl</strong> to call the API, for example <code>http://127.0.0.1:5000/sync/api/v1.0/users</code>, which should return JSON format of all users, but the result is <code>Could not get any response: There was an error connecting to http://127.0.0.1:5000/sync/api/v1.0/users.</code></p>
  
  <p>I have no idea why this happens.
  Thanks for any help and suggestion!</p>