I have a Python FastAPI app that is using uvicorn. I have it packaged in docker container. When I run the app (in Power Shell on my Windows 10 machine) with a command like this: docker run -p 8080:8080 my-image-name
I get the following uvicorn startup text:
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
When I press CTRL+C
to kill the app, nothing happens. I always end up having to close the terminal to get it to stop.
Is this due to the fact that it's running in a docker container?
I know I can run the container in detached mode (-d
), but sometimes I want to watch the container logs as they happen.
How can I kill the docker image and uvicorn process AND keep the terminal still running?
-it
forpodman run
and JSON-array form for myENTRYPOINT
,uvicorn
does not exit with Ctrl+C. – Montero