shinebayar-g / ufw-docker-automated

Manage docker containers firewall with UFW!
Apache License 2.0
198 stars 31 forks source link

Not able to connect to container through WAN #16

Closed Yamakasi closed 3 years ago

Yamakasi commented 3 years ago

I have installed this great overthought service but I don't seem to be able to connect to my container.

The rule is added automaticly on container create (port 9999 mapped):

10.0.1.2 80/tcp ALLOW FWD Anywhere # whoami:3f4ca202aaffe2ec4e8c151a4085346a9515e4f808921141f53de17e00d0136a

The rule seems to be fine, is this a ufw-docker issue or something else ?

Refering to: https://github.com/chaifeng/ufw-docker/issues/50

shinebayar-g commented 3 years ago

Hi @Yamakasi what's your full docker run command or docker-compose file?

Yamakasi commented 3 years ago

@shinebayar-g Here you go:

docker run -d -p 9999:80 -l UFW_MANAGED=TRUE --name whoami -t jwilder/whoami

shinebayar-g commented 3 years ago

If the image you're running is jwilder/whoami I believe it runs on port 8000, not 80.

docker run -d -p 9999:8000 -l UFW_MANAGED=TRUE --name whoami -t jwilder/whoami

This command works. After this I was able to hit the container.

❯ curl 192.168.50.234:9999
I'm 7f5b5fa3ef36
vagrant@ubuntu18-docker:~$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
22 (v6)                    ALLOW       Anywhere (v6)

172.17.0.2 8000/tcp        ALLOW FWD   Anywhere                   # whoami:7f5b5fa3ef363a8dbf7447a089a3eeabd277ace66bf47867843a5cd3d7527326
Yamakasi commented 3 years ago

@shinebayar-g You are completely right, sorry my mistake and it works well!

I actually ran into this test because I was adding manually rules before for existing containers like SMTP which had the same issue but that seems to be resolved as well.

Thanks for the great module!

shinebayar-g commented 3 years ago

Glad it worked.