How to fix Error response from daemon: network not found in Docker

DockerBEGINNERLOWUpdated Dec 6, 2025ยท 204 views

This error occurs when Docker cannot find the network specified in your command or docker-compose file. The network may have been deleted, never created, or the name is misspelled. The fix involves recreating the network or updating your configuration.

Quick fix

Fixes Error response from daemon: network not found

docker network ls
  1. Check if the network exists
  2. Create the missing network
  3. Fix external network declaration in docker-compose
  4. Handle zombie networks
docker โ€” error
docker network ls
Error response from daemon: network not found

What this error means

The "network not found" error occurs when Docker tries to connect a container to a network that doesn't exist in the Docker daemon's registry. Docker maintains a list of networks, and when you reference a network by name or ID that isn't in this list, you get this error. This commonly happens when: - The network was manually deleted or pruned while containers still reference it - You're using docker-compose with an external network that was never created - A container was started with a specific network that no longer exists - Docker was restarted and some network metadata was lost (zombie networks) - The network name in your configuration has a typo or case mismatch Docker networks are case-sensitive, so "MyNetwork" and "mynetwork" are treated as different networks. Additionally, networks created by docker-compose typically follow the naming pattern `<project>_<network>` unless explicitly named.

Typical symptoms

  • docker run fails with 'network <name> not found'
  • docker-compose up fails with 'network declared as external, but could not be found'
  • Container start fails referencing a network ID that no longer exists
  • docker network rm says 'network not found' even though docker network ls shows it
  • Error appears after running docker system prune or docker network prune
  • Containers that previously worked fail after Docker daemon restart

Common causes

  1. The network was deleted with docker network rm or docker network prune
  2. The network was declared as external in docker-compose but never created manually
  3. Docker daemon was restarted and the network metadata became corrupted (zombie network)
  4. The network name is misspelled or has incorrect casing
  5. Old container configurations reference networks that no longer exist
  6. A docker-compose project was removed without properly cleaning up its networks

How to fix "Error response from daemon: network not found"

1Check if the network exists

First, verify whether the network actually exists:

bash
docker network ls

Look for the network name in the output. If you don't see it, the network needs to be created.

You can also search for a specific network:

bash
docker network ls --filter name=<network_name>

Note: Network names are case-sensitive. "myapp" and "MyApp" are different networks.

2Create the missing network

If the network doesn't exist, create it:

bash
docker network create <network_name>

For a specific driver (bridge is default):

bash
docker network create --driver bridge <network_name>

If using docker-compose with external networks, create the network before running docker-compose up:

bash
docker network create my_external_network
docker-compose up -d
3Fix external network declaration in docker-compose

If you're using docker-compose with external networks, ensure the network exists or change your configuration.

Option 1: Create the external network first:

bash
docker network create my_network

Option 2: Let docker-compose manage the network by removing the external declaration:

yaml
# Before (requires pre-existing network)
networks:
  my_network:
    external: true

# After (docker-compose creates the network)
networks:
  my_network:
    driver: bridge

Option 3: Use external with the correct name:

yaml
networks:
  my_network:
    external: true
    name: actual_network_name  # Must match exactly
4Handle zombie networks

Sometimes Docker shows a network in docker network ls but fails to remove or use it (zombie network). This typically happens after Docker crashes or is forcefully stopped.

Solution: Restart the Docker daemon:

bash
# Linux
sudo systemctl restart docker

# macOS/Windows Docker Desktop
# Restart Docker Desktop from the menu bar/system tray

After restart, the zombie network should be properly removed, and you can create a new one:

bash
docker network create <network_name>
5Force recreate containers and networks

If using docker-compose and the network state is inconsistent, force recreation:

bash
docker-compose down --remove-orphans
docker-compose up --force-recreate -d

For a complete reset including volumes (warning: this deletes data):

bash
docker-compose down --volumes --remove-orphans
docker network prune -f
docker-compose up -d
6Remove orphaned containers referencing old networks

Old containers may reference networks that no longer exist. Find and remove them:

bash
# List all containers (including stopped)
docker container ls -a

# Remove old containers
docker container rm <container_id>

# Or remove all stopped containers
docker container prune

After removing orphaned containers, you can cleanly recreate your networks and start fresh.

Advanced notes

Overlay networks in Swarm mode: Overlay networks are scoped to the swarm and can only be used with swarm services. If you try to use an overlay network with docker run on a single node, you'll get "network not found" because overlay networks aren't visible to standalone containers. Use docker service create --network <overlay_network> instead.

Network inspection for debugging: When troubleshooting, inspect the network configuration:

bash
docker network inspect <network_name>

This shows:
- Connected containers
- IPAM configuration (subnet, gateway)
- Network driver and options
- Labels and other metadata

Docker Compose project prefixing: Docker Compose prefixes network names with the project name (usually the directory name). A network defined as mynet in a project called webapp becomes webapp_mynet. Reference it correctly:

bash
docker network ls --filter name=webapp_mynet

Attachable networks: For overlay networks that need to work with both swarm services and standalone containers, create them with the attachable flag:

bash
docker network create -d overlay --attachable my_overlay

Network aliases: If containers need to reach each other by name, ensure they're on the same user-defined network. The default bridge network doesn't provide automatic DNS resolution between containers.

Cleaning up stale networks: Periodically clean unused networks:

bash
docker network prune

This removes all networks not used by at least one container. Use with caution in production as it may remove networks that stopped containers depend on.

Frequently asked questions

What does "Error response from daemon: network not found" mean?
The "network not found" error occurs when Docker tries to connect a container to a network that doesn't exist in the Docker daemon's registry. Docker maintains a list of networks, and when you reference a network by name or ID that isn't in this list, you get this error. This commonly happens when: - The network was manually deleted or pruned while containers still reference it - You're using docker-compose with an external network that was never created - A container was started with a specific network that no longer exists - Docker was restarted and some network metadata was lost (zombie networks) - The network name in your configuration has a typo or case mismatch Docker networks are case-sensitive, so "MyNetwork" and "mynetwork" are treated as different networks.
How do I fix "Error response from daemon: network not found"?
This error occurs when Docker cannot find the network specified in your command or docker-compose file. The network may have been deleted, never created, or the name is misspelled. The fix involves recreating the network or updating your configuration.
What causes "Error response from daemon: network not found"?
The network was deleted with docker network rm or docker network prune The network was declared as external in docker-compose but never created manually Docker daemon was restarted and the network metadata became corrupted (zombie network)
Is the "Error response from daemon: network not found" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading