network fix8-d3-backend declared as external, but could not be found — the Compose file marks a network external: true, which tells Compose to use a network that already exists, and no network of that name exists on the Docker engine. Create it with docker network create, or drop external so Compose creates it for you.

Pick the fix by intent. If the network is shared with another project or created by a script, create it once by its exact name and run docker compose up again. If only this project uses it, delete the external: true line and let Compose own the network.

The error

PS> docker compose up -d
network fix8-d3-backend declared as external, but could not be found

The command exited with code 1 and created nothing: no container line was printed. The Compose file that produced it:

name: fix8-d3-ext
services:
  web:
    image: alpine
    command: ["sleep", "5"]
    networks:
      - backend
networks:
  backend:
    name: fix8-d3-backend
    external: true

Why it happens

external: true says the network belongs to someone else: another project, a script, or a docker network create run by hand. The name in the message is the name: value from the file, fix8-d3-backend, and at that moment the engine had no network with that name. Compose did not create one; it stopped before creating the container.

You meet this when the project moves to a machine where the network was never created, or when the step that created it was not written down. Compare the name in the message with the output of docker network ls before you create anything.

The fix

Create the network by the name in the message, then start the project again:

PS> docker network create fix8-d3-backend
ac1dc31e50273b41c6e9d201af93b63773c3ada6ae3d7742f8e6d7aa98ae6488
PS> docker compose up -d
 Container fix8-d3-ext-web-1 Creating
 Container fix8-d3-ext-web-1 Created
 Container fix8-d3-ext-web-1 Starting
 Container fix8-d3-ext-web-1 Started 

After docker compose down the external network was still listed by docker network ls --filter name=fix8-d3-backend --format '{{.Name}}': Compose removed the container and left the network, which it does not own. That is what you want for a shared network, and it is also why the network has to be removed by hand with docker network rm when you are done.

The second fix, when no other project needs the network, is to remove the external line. With this file Compose created the network on up and removed it on down:

networks:
  backend:
    name: fix8-d3-backend2
PS> docker compose up -d
 Network fix8-d3-backend2 Creating
...
 Network fix8-d3-backend2 Created
...
 Container fix8-d3-ext2-web-1 Started 

How it was reproduced

A Compose file with one alpine service running sleep 5, attached to a network declared external: true under the name fix8-d3-backend, which had never been created. Run with docker compose up -d from Windows PowerShell 5.1 on Docker Engine 29.9.2 and Docker Compose v5.6.1 (Docker Desktop on Windows 11). The names carry this test's fix8-d3- prefix; your message names your own network. Every container and network was removed afterwards.

Frequently asked

What does external: true mean for a Docker Compose network?
It tells Compose that the network already exists and is managed outside this project. Compose looks it up by name and stops with 'declared as external, but could not be found' when it is missing, instead of creating it.
How do I fix 'network declared as external, but could not be found'?
Run docker network create with the exact name from the message, then docker compose up again. If no other project shares the network, remove the external: true line and Compose creates the network itself.
Does docker compose down remove an external network?
In this test it did not. After docker compose down the container was gone and the external network was still listed by docker network ls, so it had to be removed with docker network rm.

More decoded errors in the Fixes category. If the network exists but a container still cannot join it, see Docker: network not found, failed to set up container networking.