Docker iptables block all traffics except domain

Hello :slight_smile:
I’m trying to block all outgoing traffic from iptables for docker’s interface docker0.
But I would like to open the access for a few domains:

How can I do that?

I tried that:

iptables -I OUTPUT -o docker0 -j DROP
iptables -I DOCKER -i docker0 -p udp --dport 53 -j ACCEPT
iptables -I DOCKER -i docker0 -p tcp -d mydomain.com --dport 80 -j ACCEPT
iptables -I DOCKER -i docker0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

Thank you.