network not found 🐳 Docker

Error response from daemon: network X not found

The container or Compose project refers to a Docker network that doesn’t exist (any more).

Seen on: Docker

Meaning

External networks in Compose must be created first, and containers created before a network was deleted keep a stale reference to the old network ID.

Common causes

  • external: true network not created
  • Network removed (docker network prune) while containers still reference it
  • Typo in network name
  • Compose project name changed, so the network name changed

⚡ Quick fix

  1. Create it: docker network create <name>
  2. Recreate containers: docker compose up -d --force-recreate
  3. Check names: docker network ls

Detailed fix by platform

Docker Compose

  1. bash
    networks:
      shared:
        external: true   # requires: docker network create shared

How to diagnose

  1. List — docker network ls
  2. Stale — Container created before the network was deleted?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.