Multicontainer setup and iptables

I would like to block incoming traffic from eth0, eth1 or wlan0 to my device (except port 80). I can’t achieve this via the docker-compose settings because some ports of a container should be exposed on the host but not to the outside.
I could solve this problem by adding rules to the iptables mangle table but how can I add iptables rules from inside a container in a multi container setup?

Found a way by solveing this:
I couldn’t achieve my goal by using docker compose as i do a port forward from the balena tunnel to a different port on eth0 with stone installed on one of my containers.
Initially i tried to use the following command on docker compose:
- “”
This could not work as i was on a bridged configuration, but with network_mode: “host” it works.

1 Like

Thanks for sharing the solution you found.