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.

Permission error on port 80

See original GitHub issue

@tiangolo any ideas on what could be causing this error:

papi_1       |   File "main.py", line 8, in <module>
papi_1       |     app.run(host='0.0.0.0', debug=True, port=80)
papi_1       |   File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 841, in run
papi_1       |     run_simple(host, port, self, **options)
papi_1       |   File "/usr/local/lib/python3.6/site-packages/werkzeug/serving.py", line 795, in run_simple
papi_1       |     s.bind(get_sockaddr(hostname, port, address_family))
papi_1       | PermissionError: [Errno 13] Permission denied

Flask should always be listening on the port 80, right?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tiangolocommented, Jun 5, 2018

Read the Docker getting started guide: https://docs.docker.com/get-started/part2/#define-a-container-with-dockerfile

It should help clarify several things.

If you listen on port 80 inside the container doesn’t mean that it will be listening on port 80 outside. For it to listen outside you have to map the ports with something like "5555:80", that would make your host listen on port 5555 and send the communication to the port 80 inside the container.

1reaction
tiangolocommented, Jun 5, 2018

Are you changing the name of the user by any chance?

For debugging purposes, try using a “non-privileged” port, like 8080, and see if that works. That would hint that there are issues with onwership of the file, root access, etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to run a server on port 80 as a normal user on Linux?
Short answer: you can't. Ports below 1024 can be opened only by root. As per comment - well, you can, using CAP_NET_BIND_SERVICE, but...
Read more >
Listening error on port 80 when nothing else is using it
Normally a web server starts with uid=0, starts listening to port (say) 80, and then switches to an unprivileged user (like www-data in...
Read more >
can't bind to port: 80 Permission denied - Google Groups
can't bind to port: 80 Permission denied. The problem is that my user probably does not have privileges to use port 80. No...
Read more >
Node.js EACCES error when listening on http 80 port ...
Node.js throws following error while running on http port 80 (default port):- Error: EACCES, Permission denied at Server.
Read more >
Permission denied in ec2 port 80 - Deploying Streamlit
You need sudo permission/root account for use the port 80. moh555m555 October 29, 2019, 3:53am ...
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