How to fix Error response from daemon: network not found in Docker
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- Check if the network exists
- Create the missing network
- Fix external network declaration in docker-compose
- Handle zombie networks
docker network lsError 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
- 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)
- The network name is misspelled or has incorrect casing
- Old container configurations reference networks that no longer exist
- A docker-compose project was removed without properly cleaning up its networks
How to fix "Error response from daemon: network not found"
First, verify whether the network actually exists:
docker network lsLook 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:
docker network ls --filter name=<network_name>Note: Network names are case-sensitive. "myapp" and "MyApp" are different networks.
If the network doesn't exist, create it:
docker network create <network_name>For a specific driver (bridge is default):
docker network create --driver bridge <network_name>If using docker-compose with external networks, create the network before running docker-compose up:
docker network create my_external_network
docker-compose up -dIf you're using docker-compose with external networks, ensure the network exists or change your configuration.
Option 1: Create the external network first:
docker network create my_networkOption 2: Let docker-compose manage the network by removing the external declaration:
# Before (requires pre-existing network)
networks:
my_network:
external: true
# After (docker-compose creates the network)
networks:
my_network:
driver: bridgeOption 3: Use external with the correct name:
networks:
my_network:
external: true
name: actual_network_name # Must match exactlySometimes 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:
# Linux
sudo systemctl restart docker
# macOS/Windows Docker Desktop
# Restart Docker Desktop from the menu bar/system trayAfter restart, the zombie network should be properly removed, and you can create a new one:
docker network create <network_name>If using docker-compose and the network state is inconsistent, force recreation:
docker-compose down --remove-orphans
docker-compose up --force-recreate -dFor a complete reset including volumes (warning: this deletes data):
docker-compose down --volumes --remove-orphans
docker network prune -f
docker-compose up -dOld containers may reference networks that no longer exist. Find and remove them:
# List all containers (including stopped)
docker container ls -a
# Remove old containers
docker container rm <container_id>
# Or remove all stopped containers
docker container pruneAfter 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:
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:
docker network ls --filter name=webapp_mynetAttachable networks: For overlay networks that need to work with both swarm services and standalone containers, create them with the attachable flag:
docker network create -d overlay --attachable my_overlayNetwork 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:
docker network pruneThis 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
- ๐Docker Official Documentation
- ๐ฌ
- ๐ฌStack Overflow: Docker Network not Found(Stack Overflow)
- ๐
- ๐
- ๐Docker Docs: Networking overview(Official Docs)
- ๐ฌDocker Forums: Docker network not found by docker-compose(Stack Overflow)