How does docker manage containers' IP addresses?

When creating containers inside a user-defined bridge network without specifying an IP address, the started containers are given IP address starting from the beginning of the IP range. When a container goes down, its IP address becomes available again and can later be used by another container. Docker also detects duplicate IPs and raise exceptions when invalid addresses are supplied. As far as my research goes, the docker daemon is not depending on any DHCP services. So how does Docker actually figure out which IP addresses is in use/available for a new container? Furthermore, how can a docker network plugin (such as docker-go-plugin ) do the same thing?

I think one of the keywords here is IPAM, but I don’t know anything apart from that. I’d appreciate every piece of information that points me to the right direction. Thanks in advance.

As already mentioned. The keyword is IPAM. Docker use a local IPAM driver, that guarantees, that every IP address is provided only once, as long as you don’t specify it explicitly.

The drawback ist, that this default IPAM driver is only considering a single machine. If you want to use more than one machine, you have to develop your own one or buy one of the available IPAM drivers, what is quite expensive. We required also an IPAM driver in the past, but haven’t found an open source one…

Good luck, and let it know when you find an easy to use IPAM driver, that can work with multiple hosts.