Apt get update not working inside container when ufw enabled (Ubuntu 20.04)

Hello Experts,

I was creating some containers with ufw enabled, following is my ufw rules. But for some reason apt get update connection fails when ufw is enabled. When i disable ufw it works. Can i enhance ufw rules to allow this update to work?

ufw status

Error i get

Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out```

Make sure you allow outbound forwarded/routed connections.

1 Like

Thanks @tomp with the following change it worked for me. Noting down for future readers

DEFAULT_FORWARD_POLICY="ACCEPT" in /etc/default/ufw