[QUESTION] Use uvicorn or gunicorn in docker CMD
See original GitHub issueFirst check
- I used the GitHub search to find a similar issue and didn’t find it.
- I searched the FastAPI documentation, with the integrated search.
- I already searched in Google “How to X in FastAPI” and didn’t find any information.
Description
I read the document Deployment
The CMD runs in docker use uvicorn
,why not gunicorn
?
Which should i use for best performance?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Running FastAPI in docker with uvicorn and gunicorn nginx
Gunicorn and uvicorn services are started using supervisord. python is installed in a virtual environment located in /opt/venv. Dockerfile FROM ...
Read more >Server Workers - Gunicorn with Uvicorn - FastAPI
You can use Gunicorn (or also Uvicorn) as a process manager with Uvicorn workers to take advantage of multi-core CPUs, to run multiple...
Read more >How to Build a Django and Gunicorn Application with Docker
Interested in Django but not sure where to start with Docker? This tutorial will walk you through first steps: modifying a sample Django ......
Read more >The Ultimate FastAPI Tutorial Part 13 - Using Docker to ...
Why use Gunicorn with Uvicorn? ... Uvicorn provides a lightweight way to run multiple worker processes, for example --workers 4 , but does...
Read more >Docker Best Practices for Python Developers - TestDriven.io
This is very inefficient, especially when using a Docker container as a ... string (shell) CMD "gunicorn -w 4 -k uvicorn.workers.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@luozhouyang this just let people to use both uvicorn and gunicorn bu using the same image to adapt different circumstance
Thanks for the help here everyone! 👏 🙇
Thanks for reporting back and closing the issue @luozhouyang 👍
About the Docker image, in short, Gunicorn starts several Uvicorn workers, it makes sure there are several processes ready to work. And each of those Uvicorn workers do the actual work.
You can read more in the docs for the Docker image: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker