Skip to content

Exposed public port cannot bind #14647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Glydric opened this issue Nov 13, 2022 · 6 comments
Closed

Exposed public port cannot bind #14647

Glydric opened this issue Nov 13, 2022 · 6 comments
Labels
type: bug Something isn't working

Comments

@Glydric
Copy link

Glydric commented Nov 13, 2022

Bug description

When i configure gitpod.yml i set

- name: web
port: 80
visibility: public

and the port shows on exposed ports as open, but if i run python -m http.server 80 or every server on 80 it say cannot bind to 0.0.0.0/80, other ports are working

Steps to reproduce

add

- name: web
port: 80
visibility: public

to config.yaml
run
python -m http.server 80

Workspace affected

No response

Expected behavior

the server should be up and working

Example repository

No response

Anything else?

No response

@Glydric Glydric added the type: bug Something isn't working label Nov 13, 2022
@axonasif
Copy link
Member

Possible duplicate of #9376

@iQQBot
Copy link
Contributor

iQQBot commented Nov 14, 2022

@Glydric22 could you try sudo python -m http.server 80

@Glydric
Copy link
Author

Glydric commented Nov 14, 2022

I have already tryied,
sudo: python: command not found

@axonasif
Copy link
Member

@Glydric22 use:

sudo -E $(command -v python3) -m http.server 80

@Glydric
Copy link
Author

Glydric commented Nov 21, 2022

@Glydric22 use:

sudo -E $(command -v python3) -m http.server 80

Seems to work... but why?

@axonasif
Copy link
Member

axonasif commented Nov 21, 2022

Seems to work... but why?

It's basically how your shell works, sudo doesn't preserve the user-environment variables by default, -E flags makes it do. Moreover, $(command -v python3) is expanded to /home/gitpod/.pyenv/shims/python3 before it gets passed as an argument to sudo, so sudo can directly execute python3 without iterating over PATH env-var to avoid possible conflict as we're using -E flag.

To see what actually happens, try:

bash -xc 'sudo -E $(command -v python3) -m http.server 80'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants