This will allow you to stop communications between containers:
Create a network with ICC disabled:
docker network create -o com.docker.network.bridge.enable_icc=false my_secure_bridge
Test with creating two containers:
docker run --name cnt1 --network=my_secure_bridge -it --rm -d alpine
docker run --name cnt2 --network=my_secure_bridge -it --rm -d alpine
docker inspect cnt1 | grep -i 172
"Gateway": "172.19.0.1",
"IPAddress": "172.19.0.2",
docker inspect cnt2 | grep -i 172
"Gateway": "172.19.0.1",
"IPAddress": "172.19.0.3",
exec into one and check:
docker exec -it cnt1 sh
check connectivity to outer world:
/ # ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=114 time=0.852 ms
64 bytes from 8.8.8.8: seq=1 ttl=114 time=0.990 ms
64 bytes from 8.8.8.8: seq=2 ttl=114 time=0.808 ms
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.808/0.883/0.990 ms
check connectivity to another container:
/ # ping -w 5 172.19.0.3
PING 172.19.0.3 (172.19.0.3): 56 data bytes
--- 172.19.0.3 ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss