Docker "failed to create endpoint on network" in CI
By Daniel Zoghalchali·Latchkey
The daemon could not attach a container to a network. failed to create endpoint <name> on network <net> usually means a leftover endpoint/veth from a crashed container, an exhausted address pool, or a stale name still bound on the network.
What this error means
A docker run / docker network connect fails with Error response from daemon: failed to create endpoint <name> on network <net>: .... The network exists but the new endpoint cannot be created.
docker
docker: Error response from daemon: failed to create endpoint quizzical_api on network bridge:
endpoint with name quizzical_api already exists in network bridge.
Common causes
A leftover endpoint from a crashed container
A container that died uncleanly can leave its endpoint/veth registered, so re-creating one with the same name collides.
The network address pool is exhausted
A bridge/network with too many attached endpoints (or a small subnet) can run out of addresses for a new endpoint.
Stale network state on the runner
Accumulated networks/endpoints from prior jobs leave the daemon network state inconsistent.
How to fix it
Disconnect the stale endpoint and prune networks
Force-remove the leftover container/endpoint and clean unused networks.
Clean up containers and networks between jobs on persistent runners.
Use unique, per-job network/container names.
Size custom network subnets for the number of endpoints you attach.
Frequently asked questions
What causes ""failed to create endpoint""?
A container that died uncleanly can leave its endpoint/veth registered, so re-creating one with the same name collides.
How do I fix "failed to create endpoint"?
Force-remove the leftover container/endpoint and clean unused networks.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.