Score:0

Cant expose a port on the host but exposing on docker works

tr flag

I have an AWS instance. All incoming and out going traffic is allowed on all ports.

I run python3 -m http.server 8000 on the host but then I cant access <hostIP>:8000 from outside the host machine.

Now If I run docker container docker run -di -p 8000:8000 ubuntu on the same host.

and inside the docker container I run python3 -m http.server 8000 I am able to GET <hostIP>:8000 from outside the host machine.

cant wrap my head around this. Any ideas about what might be happening?

PS: I did a tcpdump and found that the host is receiving the tcp SYN packet but its not responding with a SYNACK.

PPS: lsof -Pi :8000

python3 13376 root 3u IPv4 71025 0t0 TCP *:8000 (LISTEN)

djdomi avatar
za flag
i belive its a binding isse, did you tried `python3 -m http.server 0.0.0.0:8000` i am not having knowledge to python but without seen any `lsof -Pi :8000` output its just a thought about
Hussain Nagri avatar
tr flag
@djdomi tried binding to 0.0.0.0. still same issue
djdomi avatar
za flag
please take care of the second part of my comment. and Remind to update the Question instead adding comments
Hussain Nagri avatar
tr flag
@djdomi `python3 13376 root 3u IPv4 71025 0t0 TCP *:8000 (LISTEN)`
in flag
What is the error message you get when you try to connect to your port?
Hussain Nagri avatar
tr flag
@GeraldSchneider No error. Requests just hangs and then timeout.
Score:0
tr flag

ufw service was blocking everything on the system. Docker was configuring ufw properly and hence was working out of the box. I stoped ufw and everything is working. Facepalm moment.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.