Docker "failed to set up container networking (bridge)" in CI
When a container starts, the daemon attaches it to a network (the default bridge or a user network) and programs the host firewall. If that attach fails - a momentary networking/iptables setup error, a races against another container, or a half-initialized bridge - the run aborts with failed to set up container networking. This is frequently a transient daemon-networking hiccup.
What this error means
A docker run or compose start fails with Error response from daemon: failed to set up container networking. A retry often succeeds.
docker: Error response from daemon: failed to set up container networking: driver failed programming external connectivity: error setting up the bridge endpointCommon causes
A transient bridge/iptables setup failure
Programming the firewall and attaching the veth to the bridge can momentarily fail under contention.
A half-initialized or stale bridge
A leftover bridge from a crashed daemon can block fresh attaches until cleaned up.
Concurrent container starts racing the bridge
Many containers attaching at once can transiently collide on network setup.
How to fix it
Re-run the container start
- This is usually transient - retry the start.
- If it clears on retry, treat it as a networking-setup blip.
docker run --rm myorg/api:1.4.2Restart the daemon to rebuild the bridge
- A persistent failure can mean a corrupt bridge - restart the daemon to recreate it.
sudo systemctl restart docker
docker network lsHow to prevent it
- Avoid huge bursts of simultaneous container starts.
- Restart the daemon if the default bridge is corrupted.
- Retry transient networking-setup failures before debugging.