I've been using Docker on Arch Linux for years, but recently I've hit a wall with this error: 'Error response from daemon: all predefined address pools have been fully subnetted.' It usually happens when I start a simple Docker Compose project that defaults to a network configuration (I didn't set any network in the compose file). I don't have any non-default networks created, and I've only got the three standard options. Restarting my system temporarily clears the issue, but it pops up again after I start my project. Is there any way to resolve this?
2 Answers
Try defining your own network range directly in your Docker Compose file. Something like:
```
networks:
name:
driver: "bridge"
ipam:
config:
- subnet: 10.22.0.0/16
```
That should give you more control over the address pool and might prevent the error from recurring.
Have you tried running a `docker system prune`? It might clean up some unused resources. Also, consider adjusting your network pool in the `/etc/docker/daemon.json` file. You can define a private subnet. For example, if you don't plan on having more than 14 services on the same network, you can use a `/28` subnet configuration:
```
{
"default-address-pools": [
{
"base": "172.16.0.0/12",
"size": 28
}
]
}
```
This setup will give you about 65,000 subnets!
Just be careful with that approach; using the entire class B subnet might mess with your routing. I recommend sticking to more tailored subnet configurations, like chunks of `/28`.