How to fix Error response from daemon: network mynetwork not found in Docker
The Docker "network not found" error occurs when you try to connect a container to a network that does not exist or has been deleted. This is typically resolved by creating the missing network or recreating your containers with the correct network configuration.
Quick fix
Fixes Error response from daemon: network mynetwork not found
docker network ls- List existing Docker networks
- Create the missing network
- Use docker-compose to recreate networks
- Force recreate containers and networks
docker network lsError response from daemon: network mynetwork not found
What this error means
This error indicates that Docker cannot locate the specified network when attempting to start a container or connect it to a network. The Docker daemon maintains a list of available networks, and when you reference a network by name or ID that isn't in this list, the operation fails. This commonly happens after a Docker restart when networks were created by docker-compose but the containers referencing them are trying to start before the networks are recreated. It can also occur if someone manually deleted a network that containers still depend on, or if there's a typo in the network name.
Typical symptoms
- Container fails to start with "network not found" message
- docker-compose up fails after Docker daemon restart
- Previously working containers suddenly cannot connect to their network
- docker run --network=mynetwork fails even though containers used this network before
- Docker stack deploy fails with network errors
Common causes
- The network was never created in the first place
- The network was deleted manually or by docker network prune
- Docker daemon was restarted and networks need to be recreated
- Typo in the network name in docker run or docker-compose.yml
- Orphaned containers from previous docker-compose runs are referencing old networks
- Network marked as external in compose file but not created externally
- VPN software interfering with Docker networking
How to fix "Error response from daemon: network mynetwork not found"
First, check which networks currently exist to see if your network is missing:
docker network lsLook for your network name in the output. If it's not listed, you'll need to create it.
If the network doesn't exist, create it manually:
docker network create mynetworkFor bridge networks with custom configuration:
docker network create --driver bridge --subnet 172.28.0.0/16 mynetworkIf you're using docker-compose, run with flags to recreate networks and remove orphaned containers:
docker-compose down --remove-orphans
docker-compose up -dThe --remove-orphans flag cleans up containers from previous runs that may be referencing deleted networks.
For persistent issues, force Docker to recreate everything:
docker-compose up --force-recreate --remove-orphansThis rebuilds all containers and their network connections from scratch.
If your docker-compose.yml declares a network as external, you must create it manually before running compose:
# docker-compose.yml
networks:
mynetwork:
external: trueCreate the external network first:
docker network create mynetwork
docker-compose up -dIf other steps fail, perform a system cleanup:
docker-compose down
docker system prune
docker-compose up -dWarning: docker system prune removes all unused containers, networks, and dangling images. Use docker system prune -a to also remove unused images.
If issues persist, restart the Docker daemon:
sudo systemctl restart dockerAdvanced notes
VPN Interference: Some VPN software (like Cisco AnyConnect) can interfere with Docker networking. If you experience persistent network issues, try disconnecting from VPN and resetting Docker to factory settings in Docker Desktop.
Swarm Mode Networks: When using Docker Swarm, networks created for stack services are scoped to the swarm. If you're moving between standalone and swarm mode, networks may not be visible in both contexts. Use docker network ls --filter driver=overlay to see swarm networks.
Network ID vs Name: Docker internally tracks networks by ID. If you see an error referencing a long hash like network 7808732465bd529e6f20e4071115218b..., this is a stale reference to a deleted network. The solution is the same: recreate containers so they get fresh network connections.
Frequently asked questions
- What does "Error response from daemon: network mynetwork not found" mean?
- This error indicates that Docker cannot locate the specified network when attempting to start a container or connect it to a network. The Docker daemon maintains a list of available networks, and when you reference a network by name or ID that isn't in this list, the operation fails. This commonly happens after a Docker restart when networks were created by docker-compose but the containers referencing them are trying to start before the networks are recreated.
- How do I fix "Error response from daemon: network mynetwork not found"?
- The Docker "network not found" error occurs when you try to connect a container to a network that does not exist or has been deleted. This is typically resolved by creating the missing network or recreating your containers with the correct network configuration.
- What causes "Error response from daemon: network mynetwork not found"?
- The network was never created in the first place The network was deleted manually or by docker network prune Docker daemon was restarted and networks need to be recreated
- Is the "Error response from daemon: network mynetwork 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 Network CLI Reference(Official Docs)
- ๐Docker Network Create Documentation(Official Docs)
- ๐ฌDocker Forums: Network not found by docker-compose(Stack Overflow)