how to develop ?
See original GitHub issueHi,
I like to develop within the docker container so that I use the same environment that is used later in prod.
I run:
docker run -it --rm -v /c/Users/myuser/chat/api:/app -p 8090:8000 my-image-name:0.0.2 uvicorn main:app --reload
So I map using -v my local directory inside the container. When I change a file locally the reloader within docker detecs it and restarts the application. That works fine. But if I try to connect to http://localhost:8090/ I get a “The connection was reset” message in the webbrowser (firefox).
Uvicorn logs that its running on http://127.0.0.1:8000 so -p 8090:8000 should work - I thought 😃
my-image-name:0.0.2 is based on tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim and basically only installs some python packages and then does a COPY /api /app I develop on Windows 10 using WSL (not WSL2).
Does anyone else had this issue ?
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (1 by maintainers)

Top Related StackOverflow Question
ah you don’t run it as
sudo… if you runsudo docker psyou can check the port mapping.Yes
One more thing, try to run the uvicorn with --host option
uvicorn main:app --host 0.0.0.0Now closed … thanks again