DEV Community

Cover image for 🚰 Docker connection reset during builds

Posted on


🚰 Docker connection reset during builds

Recently while trying to deploy a test docker container on my homelab's docker instance, I kept running into an error similar to this one

Caused by: Connection reset
Enter fullscreen mode Exit fullscreen mode

After a bunch of digging, I ran into this medium article;

It summarized it's findings pretty well and walked through the whole discovery process. Something I appreciate.

Ultimately for it, it boiled down to running these commands to backup, flush, and reset iptables

# Keep a backup of the current rules incase we have to go back
iptables-save > /root/firewall.rules

# Flush all the current rules
iptables -F
iptables -X
iptables -P INPUT ACCEPT

# Confirm the rules are now empty
iptables -L
Enter fullscreen mode Exit fullscreen mode

Then I had to restart docker with service docker restart for docker to reset it's own iptable rules. But from then on, no more connection reset issues.

In the event you need to roll back, you can use

iptables-resoter < /root/firewall.rules
Enter fullscreen mode Exit fullscreen mode

Now get back to building something awesome!

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git