Interview Prep/Docker/Networking, DNS and Compose

Connection from container to DB `connection reset by peer` only under load.

AdvancedTroubleshootingNetworking, DNS and Compose
Answer

Likely causes → Conntrack table full (nf_conntrack: table full, dropping packet), DB max connections, ephemeral port exhaustion, idle connection killed by NAT.

Diagnose →

dmesg | grep conntrack
sysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max
ss -s

Fix → Raise nf_conntrack_max, use connection pooling, increase port range, tune keepalive.

Prevent → Monitor conntrack usage.

All Docker questions Roadmap: Docker & containers

More on Networking, DNS and Compose