Docker Problems In Almalinux 8

Docker Problems In Almalinux 8

I kept having issues with Docker in Almalinux 8/Cloudlinux 8/Centos 8. Basically, any time that the server would reboot, my Docker containers would fail to start. If I restarted the Docker service manually, it would start working. The problem is that Docker manipulates iptables, but when the Firewall would start, Docker’s iptables would be overwritten. After doing a lot of Googling, it seems I have found a solution.

To resolve this create the following in /etc/csf/csfpre.sh

iptables -t nat -N DOCKER
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
iptables -t nat -A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
iptables -t nat -A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE

iptables -t filter -N DOCKER
iptables -t filter -A FORWARD -o docker0 -j DOCKER
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

I found this solution posted here.

Leave a Reply

Your email address will not be published. Required fields are marked *