Docker启动项目及配置时遇Pool overlaps错误的解决方法咨询
Hey there, that error crops up when Docker attempts to assign a subnet to a new network that’s already occupied—whether by another Docker network, your host machine’s local network, or even an active VPN connection. Let’s break down the fixes step by step:
Step 1: Identify the conflicting subnet
First, you need to pinpoint which network is causing the overlap:
- List all Docker networks with:
docker network ls - Inspect each network to check its subnet (replace
<network-name>with the actual name from the list):
Look for thedocker network inspect <network-name>"Subnet"field in the output—this will show you the IP range the network is using. - Also check your host’s active networks:
- Linux/macOS: Run
ip addr - Windows: Run
ipconfig
Compare these ranges to the one Docker is trying to use for yourmy_projectto spot the overlap.
- Linux/macOS: Run
Step 2: Resolve the conflict
Choose the fix that fits your scenario:
Option 1: Delete the conflicting Docker network
If the overlap is with a custom Docker network you no longer need (or can reconfigure):
- Stop any containers using that network:
docker stop <container-name> - Delete the conflicting network:
docker network rm <network-name> - Restart your
my_project—Docker will either auto-assign a non-conflicting subnet, or you can specify one manually (see Option 2).
Option 2: Specify a custom subnet in your docker-compose.yml
If you’re using Docker Compose for my_project, explicitly define a subnet that doesn’t overlap with existing networks. Add this to your docker-compose.yml:
networks: default: ipam: config: - subnet: 192.168.200.0/24
Pick a range like 192.168.xxx.0/24 or 172.30.xxx.0/24—avoid common default Docker ranges like 172.17.0.0/16 or 172.18.0.0/16.
Option 3: Reset Docker’s default network (for default bridge conflicts)
If the overlap is with Docker’s default bridge network, you’ll need to reset it (note: this will wipe all existing Docker networks and containers, so back up data first):
- Stop the Docker service:
- Linux:
sudo systemctl stop docker - macOS: Quit Docker Desktop from the menu bar
- Windows: Stop the Docker Desktop Service via Services, or quit from the system tray
- Linux:
- Delete Docker’s network database (Linux only):
For macOS/Windows, use Docker Desktop’s "Reset to factory defaults" option under Settings > Troubleshoot.sudo rm -rf /var/lib/docker/network/files/local-kv.db - Restart Docker, then launch your
my_projectagain.
Option 4: Check for VPN conflicts
If you’re running a VPN, it might be using the same subnet as Docker. Try temporarily disconnecting the VPN, starting your project, then reconnecting. If that works, adjust your VPN’s subnet settings to avoid the overlap.
内容的提问来源于stack exchange,提问作者bruna_dosti




