Docker "network not found" - Fix Missing Networks in CI
A container or compose service referenced a Docker network that does not exist on the runner. Either it was never created or it was pruned away.
What this error means
A docker run --network <name> or docker compose up fails with network <name> not found, or compose reports a network "declared as external" but missing.
Error response from daemon: network mynet not found
# compose:
network "shared" declared as external, but could not be foundCommon causes
External network never created
A compose file marks a network external: true, expecting it to pre-exist, but no docker network create ran in the pipeline.
A prune removed the network
docker system prune or network prune between steps can delete an unused network that a later step expects.
Networks not shared across jobs
A network created in one job does not exist in another job on a different runner.
How to fix it
Create the external network before use
Provision the network as an explicit step, or let compose manage it (drop external).
docker network create shared || true
docker compose up -dLet compose own the network
Remove external: true so compose creates and tears down the network itself.
networks:
shared:
# no 'external: true' - compose creates itHow to prevent it
- Create external networks explicitly before steps that need them.
- Avoid pruning networks mid-pipeline when later steps depend on them.
- Prefer compose-managed networks for self-contained jobs.