• PlexSheep@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    9 months ago

    What is a good firewall that can also block ports published with docker? I’d need it to run on the same host.

    • derpgon@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      9 months ago

      UFW does work with Docker, but requires some tweaking. IIRC you have to disallow Docker to modify IPTables and then add a rule to forward all traffic to the Docker network of your choice. It’s a little finicky but works.

      • JasonDJ@lemmy.zip
        link
        fedilink
        arrow-up
        0
        ·
        9 months ago

        But…why?

        Project Calico is designed for segmenting network traffic between kubernetes workloads.

        Right tool for the job.

        Also if you are a Fortinet shop, supposedly you can manage rules with FortiManager. I haven’t tried that yet but it looks really cool.

    • dan@upvote.au
      link
      fedilink
      arrow-up
      0
      ·
      9 months ago

      Are your Docker containers connecting to the network (eg using ipvlan or macvlan)? The default bridge network driver doesn’t expose the container publicly unless you explicitly expose a port. If you don’t expose a port, the Docker container is only accessible from the host, not from any other system on the network.

        • dan@upvote.au
          link
          fedilink
          arrow-up
          0
          ·
          9 months ago

          If you don’t want the Docker container to be accessible from other systems then just don’t publish the port.

    • Crack0n7uesday@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      9 months ago

      You want a virtual firewall. Is this for profit or just your science project because that’s going to change the answer. You might hate me, but I’m still gonna say it, Cisco…

      • PlexSheep@feddit.de
        link
        fedilink
        arrow-up
        0
        ·
        9 months ago

        I remember trying with ufw and the docker ports were still open. Iirc I’ve read somewhere that docker and ufw both use the same underlying software, so ufw cannot block docker (IP tables?)

        • iiGxC@slrpnk.net
          link
          fedilink
          arrow-up
          0
          ·
          9 months ago

          Hmm, not sure. I know with docker you can “mock” ports for the container, where the port the container sees is different than the port on the system. Maybe you can do something with that?