Linux – docker0: iptables: No chain/target/match by that name.

Problem :

Error response from daemon: Cannot restart container odoo14: driver failed programming external connectivity on endpoint odoo14 (3a3173825ce9958174fc4f6e32ae2e1a35fde50648086778e6c8e10895c436ba): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8014 -j DNAT --to-destination 172.17.0.3:8069 ! -i docker0: iptables: No chain/target/match by that name.

masalah diatas disebabkan service firewall/iptables di restart / flush sehingga rules iptables yang dicreate oleh Docker ikut kehapus

Solving :

sudo mkdir /etc/systemd/system/docker.service.d/
sudo vi /etc/systemd/system/docker.service.d/noiptables.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --iptables=false
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo docker start yourNameContainer
sudo vi /etc/csf/csfpost.sh
#!/bin/sh

echo "[DOCKER] Create Firewall rules."

iptables -N DOCKER
iptables -t nat -A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
iptables -t filter -A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -t filter -A FORWARD -i docker0 ! -o docker0 -j ACCEPT
iptables -t filter -A FORWARD -i docker0 -o docker0 -j ACCEPT

echo "[DOCKER] Firewall Done."
sudo chmod +x /etc/csf/csfpost.sh
sudo csf -a 172.17.0.0/16