docker / python-docker-dev

A simple Python app for the Python Language Guide in Docker's Docs
11 stars 32 forks source link

Docker compose fails due to missing gunicorn dependency #8

Closed rainzoo closed 10 months ago

rainzoo commented 10 months ago

Following the Python docker tutorial: https://docs.docker.com/language/python/develop/#add-a-local-database-and-persist-data

docker compose up --build failed with the error:

server-1  | /bin/sh: 1: gunicorn: not found
server-1 exited with code 127

The requirements.txt file does not include gunicorn which Dockerfile expects:

CMD ["/bin/sh" "-c" "gunicorn 'app:app' --bind=0.0.0.0:8000"]

Please add gunicorn to the requirements.txt

craig-osterhout commented 10 months ago

Thanks for sharing the issue. It appears you may have selected the default values when running docker init. The sample app uses flask and requires a different command as specified in the example at https://docs.docker.com/language/python/containerize/#initialize-docker-assets

It's an easy thing to overlook and we should probably call it out better in the documentation. Closing this as it's not an issue with the sample app, but an issue within the docs.