Discourse נכשל בהתחלה עקב בעיית docker/iptables

סיכום מבוסס בינה מלאכותית

The user Isambard is experiencing an issue with Discourse failing to start due to a Docker/iptables error, specifically related to a missing chain or match in the iptables configuration. The error occurs when running ./launcher start app, and despite iptables-save showing the DOCKER chain, the system cannot apply the necessary rules. The user notes that the DOCKER chain exists in the rules but still encounters the error. Isambard speculates this might be due to a timing issue when rapidly starting and stopping containers, which can disrupt NAT tables. Ultimately, the user resolved the issue by restarting the Docker service.

Trying a ./launcher start app and I get the following error:

Error response from daemon: driver failed programming external connectivity on endpoint  ():  (iptables failed: iptables --wait -t filter -A DOCKER ! -i docker0 -o docker0 -p tcp -d 172.17.0.5 --dport 80 -j ACCEPT: iptables: No chain/target/match by that name.  (exit status 1)) Error: failed to start containers:

It claims no chain/match but iptables-save shows:

:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A POSTROUTING -s 172.17.0.2/32 -d 172.17.0.2/32 -p tcp -m tcp --dport 443 -j MASQUERADE
-A POSTROUTING -s 172.17.0.3/32 -d 172.17.0.3/32 -p tcp -m tcp --dport 5432 -j MASQUERADE
-A POSTROUTING -s 172.17.0.2/32 -d 172.17.0.2/32 -p tcp -m tcp --dport 80 -j MASQUERADE
-A POSTROUTING -s 172.17.0.4/32 -d 172.17.0.4/32 -p tcp -m tcp --dport 80 -j MASQUERADE
-A POSTROUTING -s 172.17.0.5/32 -d 172.17.0.5/32 -p tcp -m tcp --dport 80 -j MASQUERADE
-A DOCKER -i docker0 -j RETURN
-A DOCKER ! -i docker0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 172.17.0.2:443
-A DOCKER ! -i docker0 -p tcp -m tcp --dport 5432 -j DNAT --to-destination 172.17.0.3:5432
-A DOCKER ! -i docker0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 172.17.0.2:80
-A DOCKER ! -i docker0 -p tcp -m tcp --dport 8086 -j DNAT --to-destination 172.17.0.4:80
-A DOCKER ! -i docker0 -p tcp -m tcp --dport 8087 -j DNAT --to-destination 172.17.0.5:

Any idea how to fix without having to restart docker service?

I think this was to a funny timing quirk where starting/stopping container rapidly messed up the NAT tables.

I gave up and restarted the docker service.