Docker "The proxy server received an invalid response from an upstream server." after system reboot

  centos7, docker, docker-compose, iptables

I’m running a Docker MERN stack on CentOS 7 with WHM, CPanels and Apache, everything works fine until I reboot the server. I get the following error on the webpage:

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request

Reason: Error reading from remote server

Additionally, a 502 Bad Gateway error was encountered while trying to use an ErrorDocument to handle the request.

After searching around stackoverflow I found that if I run this sequence of commands my problem is solved:

iptables -t filter -F
iptables -t filter -X
systemctl restart docker

My question is, how do I configure my server so I don’t need to run these commands everytime my server reboots? Do I make a script to run these commands everytime it restarts? Do I configure iptables?

Source: Docker Questions

LEAVE A COMMENT