title: Using gunicorn with ubuntu:latest Docker image
body: <p>I'm trying to setup a Gunicorn server inside an Ubuntu:latest Docker image.</p>
  <p>When launching on Docker, I have the following output</p>
  <pre><code>[2020-08-01 14:12:38 +0000] [6] [INFO] Starting gunicorn 20.0.4
  [2020-08-01 14:12:38 +0000] [6] [DEBUG] Arbiter booted
  [2020-08-01 14:12:38 +0000] [6] [INFO] Listening at: http://0.0.0.0:5000 (6)
  [2020-08-01 14:12:38 +0000] [6] [INFO] Using worker: sync
  [2020-08-01 14:12:38 +0000] [8] [INFO] Booting worker with pid: 8
  [2020-08-01 14:12:38 +0000] [6] [DEBUG] 1 workers
  </code></pre>
  <p>After that, I can't see any output on terminal. I checked the ports using <code>sudo netstat -tunlp</code> opened on my computer and Gunicorn isn't running.</p>
  <p>It works fine if I use the same setup using <code>gunicorn --bind 0.0.0.0:5000 app:app --log-level debug</code> inside a virtualenv... Is there anything I am missing up ?</p>
  <pre><code># ------------------------------------------------------------------------------
  # Production image based on ubuntu:latest with nginx &amp; python3
  # ------------------------------------------------------------------------------
  FROM ubuntu:latest as prod-react
  
  WORKDIR /usr/src/app
  
  # update, upgrade and install packages
  RUN apt-get update &amp;&amp; apt-get install -y --no-install-recommends apt-utils
  RUN apt-get upgrade -y
  RUN apt-get install -y nginx curl python3 python3-distutils python3-apt
  
  # install pip
  RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  RUN python3 get-pip.py
  
  # copy flask-api requirements file and install modules
  COPY ./flask-api/requirements.txt ./
  RUN pip install -r requirements.txt
  RUN pip install gunicorn
  
  # copy flask code
  COPY ./flask-api/app.py .
  
  # ------------------------------------------------------------------------------
  # Serve flask-api with gunicorn
  # ------------------------------------------------------------------------------
  EXPOSE 5000
  CMD gunicorn --bind 0.0.0.0:5000 app:app --log-level debug
  </code></pre>
  <p>Flask python code</p>
  <pre class="lang-py prettyprint-override"><code>from flask import Flask, request
  from flask_cors import CORS
  from flask_restful import Api, Resource
  import time
  
  # ------------------------------------------------------------------------------
  # Flask app config + CORS
  # ------------------------------------------------------------------------------
  app = Flask(__name__)
  app.config.from_object(__name__)
  app.config['DEBUG'] = True
  
  # accept CORS from frontend app
  CORS(app, origins=['*'], supports_credentials=True)
  
  # ------------------------------------------------------------------------------
  # RESTFUL API
  # ------------------------------------------------------------------------------
  API_PREFIX = '/api'
  api = Api(prefix=API_PREFIX)
  
  
  class AuthenticationAPI(Resource):
      def get(self):
          print('auth get', flush=True)
          return {'res': 'get'}, 200
  
      def post(self):
          print('auth post', flush=True)
          print(request.get_json())
          return {'res': 'post'}, 200
  
  
  class TimeAPI(Resource):
      def get(self):
          print('time get', flush=True)
          return {'res': time.time()}, 200
  
  
  api.add_resource(AuthenticationAPI, '/auth')
  api.add_resource(TimeAPI, '/time')
  
  api.init_app(app)
  </code></pre>