FULL AI ANALYSIS

docker-compose fails with 'no such network' after compose v2 upgrade; existing overlay network collisions on Ubuntu 22.04

Generated Oct 30, 2026, 9:42:12 AM

Analysis summary

After upgrading to compose v2 the CLI namespaces project networks differently and will create/expect local bridge networks named like _default unless explicitly declared external. That can collide with pre-existing overlay networks created earlier (same name). Docker Engine allows multiple networks to share the same user-facing name across drivers but compose treats missing external networks as an error. Attempts to remove networks can orphan running services that still depend on the overlay; simply recreating a bridge network with the same name may not resolve driver mismatches. The safe fix is to explicitly declare the intended network driver in compose files or rename external networks and rebind stacks, or recreate the external network with the correct driver after stopping dependent services.

Possible causes

Compose v2 changed network-scoping/namespace behavior and created a local bridge network with same human name as an existing overlay network

85%

An external script previously created an overlay network with the same name; compose tries to use it but driver mismatch causes errors

70%

Leftover network metadata from an earlier docker network rm left ambiguous entries and daemon cache needs restart

40%

Swarm mode or other orchestrator attached services that prevent network recreation until they are removed

35%

Suggested fixes

1

Diagnostic step 1

List networks and inspect both entries: docker network ls --no-trunc and docker network inspect <ID> to confirm driver (bridge vs overlay) and attached containers

2

Diagnostic step 2

Identify which running services depend on the overlay: docker ps --filter network=<network-name> or docker network inspect <overlay-ID>

3

Diagnostic step 3

Avoid force-removing an overlay while services use it; stop dependent services (docker service rm or stop containers) before network removal

4

Diagnostic step 4

If compose should use the overlay, add networks: external: true to the compose YAML and point to the overlay by exact name, then run docker compose up

5

Diagnostic step 5

If compose should create a bridge, change the project network name (COMPOSE_PROJECT_NAME) or set explicit name in compose to avoid collision and recreate the network safely