Docker connection refused between two containers

Answering my own question :

The problem here is with Centos 8, not docker. In fact it’s firewalld that block any connection between containers. Disabling completely firewalld will make the containers communicate again :slight_smile: but stopping firewalld isn’t a good idea, I mean about security.

So here is what I’ve done :

  1. Remove all existing rule in firewalld (about port / interfacce)
  2. Execute the following commands line to open everything needed for container to works :

shell

firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --reload
systemctl restart docker

firewall-cmd --zone=public --add-masquerade --permanent do the trick.

2 Likes