Docker docs:

Docker routes container traffic in the nat table, which means that packets are diverted before it reaches the INPUT and OUTPUT chains that ufw uses. Packets are routed before the firewall rules can be applied, effectively ignoring your firewall configuration.

    • qaz@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      18 days ago

      Yes, you can fix it by doing this

      echo "Adding rules for Docker subnets to allow communication between containers..."
      for subnet in $(docker network inspect bridge -f '{{range .IPAM.Config}}{{.Subnet}} {{end}}'); 
          sudo ufw allow from $subnet
          echo "Added rule for $subnet"
      done