The server refused to connect
See original GitHub issueI am running the image in a container. It runs successfully. The terminal output is:
[2019-06-18 15:17:00 +0000] [1] [INFO] Starting gunicorn 19.9.0
[2019-06-18 15:17:00 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1)
[2019-06-18 15:17:00 +0000] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker
[2019-06-18 15:17:00 +0000] [8] [INFO] Booting worker with pid: 8
[2019-06-18 15:17:00 +0000] [9] [INFO] Booting worker with pid: 9
[2019-06-18 15:17:01 +0000] [8] [INFO] Started server process [8]
[2019-06-18 15:17:01 +0000] [9] [INFO] Started server process [9]
[2019-06-18 15:17:01 +0000] [9] [INFO] Waiting for application startup.
[2019-06-18 15:17:01 +0000] [8] [INFO] Waiting for application startup.
But whenever I hit 0.0.0.0:80, it says “Refused to connect”. It only happens if I connect it through a docker container. If I run it without a docker container, it works like charm.
Edit: None of the ports are working. So changing port is not solving the problem.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)

Top Related StackOverflow Question
my dockerfile is :
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7 COPY ./app /app ADD requirements.txt /app RUN pip install -r requirements.txt RUN pip install email-validator EXPOSE 8081:8081 ENV GUNICORN_CONF=“/app/gunicorn_conf.py”
and run it with dokcer get the same result :
[2019-12-05 03:20:42 +0000] [1] [INFO] Starting gunicorn 19.9.0 [2019-12-05 03:20:42 +0000] [1] [DEBUG] Arbiter booted [2019-12-05 03:20:42 +0000] [1] [INFO] Listening at: http://127.0.0.1:8081 (1) [2019-12-05 03:20:42 +0000] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker [2019-12-05 03:20:42 +0000] [9] [INFO] Booting worker with pid: 9 [2019-12-05 03:20:42 +0000] [10] [INFO] Booting worker with pid: 10 [2019-12-05 03:20:42 +0000] [11] [INFO] Booting worker with pid: 11 [2019-12-05 03:20:42 +0000] [9] [INFO] Started server process [9] [2019-12-05 03:20:42 +0000] [9] [INFO] Waiting for application startup. [2019-12-05 03:20:42 +0000] [12] [INFO] Booting worker with pid: 12 [2019-12-05 03:20:42 +0000] [10] [INFO] Started server process [10] [2019-12-05 03:20:42 +0000] [10] [INFO] Waiting for application startup. [2019-12-05 03:20:42 +0000] [1] [DEBUG] 4 workers [2019-12-05 03:20:42 +0000] [11] [INFO] Started server process [11] [2019-12-05 03:20:42 +0000] [11] [INFO] Waiting for application startup. [2019-12-05 03:20:42 +0000] [12] [INFO] Started server process [12] [2019-12-05 03:20:42 +0000] [12] [INFO] Waiting for application startup.
i don not know how to remove the cmd command 。 can you share your method?
How did you run the command through docker ?