Docker driver failed programming external connectivity fix
Your container will not start, and the daemon answers with driver failed programming external connectivity on endpoint … Docker could not wire the published host port to the container, so the run or compose up fails before your application ever boots. The useful part of the error is the tail after the endpoint ID, and it comes in three flavors — each one points at a different cause and a different fix.
I burned a Friday-night redeploy on this once. The compose file was unchanged, the port map was correct, and ss showed the port as free — yet every start attempt died with the same message. The container that owned the port was still running, just in another project I had forgotten about, and its docker-proxy was the process answering on the socket. That is the shape of this error: the daemon's message is generic on purpose, and the tail tells you which layer refused the port mapping.
TL;DR
- The error is a port-publishing failure, not an application error. Docker failed to bind a host port to the container, so nothing in your image or entrypoint is the problem.
- Read the tail.
bind: address already in useorFailure EADDRINUSE= a host process owns the port.port is already allocated= Docker's own allocator thinks another container holds it.iptables: No chain/target/match by that name= the firewall rules Docker needs were flushed. - Diagnose before restarting anything:
ss -tlnpfor host listeners,docker ps -afor the invisible container, and only thensudo systemctl restart dockeras the state-reset fix. - Restarting the daemon is a fix, not a root-cause analysis. It recreates firewall chains and reaps stale proxies, but if a host service or another project's container owns the port, the error comes straight back on the next start.
- Do not fix this by silently disabling Docker's firewall integration (
--iptables=false) or by flushing rules yourself — that removes the NAT layer that makes published ports reachable at all.