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.

  • grrgyle@slrpnk.net
    link
    fedilink
    arrow-up
    23
    ·
    5 hours ago

    If I had a nickel for every database I’ve lost because I let docker broadcast its port on 0.0.0.0 I’d have about 35¢

      • grrgyle@slrpnk.net
        link
        fedilink
        arrow-up
        2
        ·
        3 hours ago

        I exposed them because I used the container for local development too. I just kept reseeding every time it got hacked before I figured I should actually look into security.

        • MangoPenguin@lemmy.blahaj.zone
          link
          fedilink
          English
          arrow-up
          5
          ·
          edit-2
          3 hours ago

          For local access you can use 127.0.0.1:80:80 and it won’t put a hole in your firewall.

          Or if your database is access by another docker container, just put them on the same docker network and access via container name, and you don’t need any port mapping at all.