network not found
DockerERRORCriticalStartupHIGH confidence

The specified Docker network does not exist

What this means

This error appears when you try to attach a container to a Docker network that has not been created. It's a configuration error, often happening in multi-container setups or when scripts expect a certain network to be present.

Why it happens
  1. 1A typo in the network name specified with the '--network' flag.
  2. 2The script or 'docker-compose.yml' file refers to a network that should have been created manually but wasn't.
  3. 3In a docker-compose setup, you are trying to run a single service that depends on a network created by the full stack.
  4. 4The network was removed, but a command or script is still trying to use it.
How to reproduce

A script attempts to run a container on a custom network named 'app-net' before creating it.

trigger — this will error
trigger — this will error
docker run -d --name my-app --network app-net my-app-image

expected output

docker: Error response from daemon: network app-net not found.

Fix 1

Create the Docker Network

WHEN The network is intended to exist and is needed for container communication.

Create the Docker Network
# Create a new bridge network
docker network create app-net

Why this works

This pre-creates the required network, making it available for containers to connect to.

Fix 2

Correct the Network Name

WHEN The error is caused by a typo.

Correct the Network Name
# List available networks to find the correct name
docker network ls
# Use the correct network name
docker run -d --name my-app --network my-app_default my-app-image

Why this works

Ensures the '--network' flag points to an existing network.

Fix 3

Use Docker Compose

WHEN Managing multiple containers that need to communicate.

Use Docker Compose
# In docker-compose.yml
services:
  app:
    image: my-app-image
    networks:
      - app-net
networks:
  app-net:
    driver: bridge

# Run compose to create networks and containers automatically
docker-compose up -d

Why this works

Docker Compose automatically handles the creation and teardown of networks defined in the YAML file, preventing this error.

What not to do

Connect all containers to the default 'bridge' network and use IP addresses.

This is brittle and breaks Docker's built-in DNS-based service discovery. Custom networks provide network isolation and allow containers to communicate using their service names.

Sources
Official documentation ↗

Docker 'network create' documentation

Networking in Compose

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Docker errors