Home > other >  Can't connect to Ubuntu Server docker container from Windows on local network
Can't connect to Ubuntu Server docker container from Windows on local network

Time:11-19

I'm starting to learn Docker.

For practice, I have set up an Nginx container on Ubuntu Server (separate PC).

Used this command docker run -it -d -p 8080:80 nginx

Then I did curl on it's home network IP (192.168.1.38:8080) and it worked fine. Showed Nginx starter page.

But then I tried to see that starter page on Windows, and curl 192.168.1.38:8080 didn't work there. It didn't open in the browser either. Gave ERR_CONNECTION_TIMED_OUT error.

I have tried to do it the other way around:

Set up the same Nginx container on a Windows machine and tried to curl it's IP:8080 from Ubuntu Server machine and it worked.

So seems like Windows lets access its IP:8080 from other devices, and Ubuntu doesn't.

CodePudding user response:

sudo ufw allow 8080/tcp on your Ubuntu Server should fix this issue.

  • Related