How to block network traffic between two docker instances using iptables?

Hi. I have two docker instances running and I know that they communicate through the docker0 interface. If I want to block traffic between only these two, i.e. specifically from instance1-ip to instance2-ip and vice versa, but no other traffic, how is it possible?

I know there is some thing called iptables but needed guidance regarding using it.