title: Gunicorn throwing error - cannot find executable on $PATH (Docker/Nginx)
body: <p>I'm trying to get gunicorn working with nginx in a docker compose file. My python code is just a flask CRUD app.</p>
  
  <p>The entry point for my flask app is at ./flask_app/app.py and I've got the following for a docker compose yaml file</p>
  
  <pre><code>version: '3'
  
  services:
  
    flask_app:
      container_name: flask_app
      restart: always
      build: ./flask_app
      ports:
        - "8000:8000"
      command: gunicorn -w 1 -b :8000 app:server
  
  
    nginx:
      container_name: nginx
      restart: always
      build: ./nginx
      ports:
        - "80:80"
      depends_on:
        - flask_app
  </code></pre>
  
  <p>and here's my app file </p>
  
  <pre><code>from flask import Flask
  from flask_marshmallow import Marshmallow
  from flask_sqlalchemy import SQLAlchemy
  
  app = Flask(__name__)
  
  app.config.from_pyfile('config.py')
  
  db = SQLAlchemy(app)
  ma = Marshmallow(app)
  
  if __name__ == '__main__':
      app.run(host='0.0.0.0', port=6000, debug=True)
  </code></pre>
  
  <p>However when I run the above I'm getting the following error</p>
  
  <pre><code>Recreating ce38627418c1_ce38627418c1_ce38627418c1_ce38627418c1_ce38627418c1_flask_app ... error
  
  ERROR: for ce38627418c1_ce38627418c1_ce38627418c1_ce38627418c1_ce38627418c1_flask_app  Cannot start service flask_app: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"gunicorn\": executable file not found in $PATH": unknown
  
  ERROR: for flask_app  Cannot start service flask_app: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"gunicorn\": executable file not found in $PATH": unknown
  ERROR: Encountered errors while bringing up the project.
  </code></pre>
  
  <p>As far as I can tell it doesn't seem my <code>app = Flask(__name__)</code> variable and I'm not sure why. I'm basing my approach on this working example <a href="https://github.com/sladkovm/docker-flask-gunicorn-nginx" rel="noreferrer">https://github.com/sladkovm/docker-flask-gunicorn-nginx</a>.</p>
  
  <p>Does anyone have any ideas?</p>
  
  <p>EDIT: In my flask_app directory I have a Dockerfile that the docker_compose file is pointing to. Here is what it looks like:</p>
  
  <pre><code>FROM python:3.6.2
  
  RUN mkdir -p /flask_app/app
  WORKDIR /flask_app/app
  COPY . /flask_app/app
  RUN pip install --no-cache-dir -r requirements.txt
  
  COPY . /flask_app/app
  </code></pre>