Skip to content

. How to run uvicorn inside Dockerfile? #8115

Closed Answered by HacKanCuBa
scheung38 asked this question in Questions
Discussion options

You must be logged in to vote

inside Dockerfile

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
:
ENTRYPOINT[]
CMD[]

Note that you are overriding ENTRYPOINT and CMD with an empty command! Which comes from CMD ["/start.sh"] => start.sh which actually runs Gunicorn with Uvicorn workers (the recommended way to run Uvicorn in production). Try removing ENTRYPOINT and CMD from your Dockerfile.

Anyway, if you still want to override that, set the CMD to be something like uvicorn --reload your_app.app:app: CMD ["uvicorn", "--reload", "your_app.app:app"].

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Kludex
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
3 participants
Converted from issue

This discussion was converted from issue #587 on February 28, 2023 12:00.