question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The server refused to connect

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dtMndascommented, Dec 5, 2019

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?

0reactions
asaimanoj17commented, Sep 7, 2022

How did you run the command through docker ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What causes the 'Connection Refused' message? - Server Fault
The message 'Connection Refused' has two main causes: Nothing is listening on the IP:Port you are trying to connect to. The port is...
Read more >
Localhost Refused to Connect Error: 5 Confirmed Ways to Fix It
5 Methods to Solve the Localhost Refused to Connect Error · 1. Temporarily Disable Your Firewall · 2. Flush Your DNS · 3....
Read more >
What can be the reasons of connection refused errors?
Connection refused means that the port you are trying to connect to is not actually open. So either you are ...
Read more >
Localhost Refused to Connect - How to Fix the Error
When developing locally the localhost refused to connect is the worst error you can get. See the causes and what solves the error....
Read more >
How to Fix the SSH "Connection Refused" Error - Kinsta
Your SSH service is down. You have the wrong credentials. The port you're trying to use is closed. SSH isn't installed on your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found