Prevent exposing ports

Now I was able to build a firewall container, attach it to macvlan network attaching any container to it’s network directly as a hook


To add something for other topic viewers

when using docker compose you could use either service name or container name

two things to consider

  1. when the container stop the network deattach forever,
    one need to set dependancies in compose file
    docker network connect container:awall tester;
    # Error response from daemon: container sharing network namespace with another container or host cannot be connected to any other network
    
  2. would fail if firewall activated in build process as a lack of --cap-add,
    one need to add the activation command to either CMD or ENTRYPOINT not RUN
    You will need some capabilities, which is explained here :

That’s very satisfying for me,
Thanks, both of you