Docker Community Forums

Share and learn in the Docker community.

Docker: Assigning IPs to containers using a DHCP server


(Meghprkh) #1

I want to get docker to assign IPs to my containers using a DHCP server, so that they are kind of static based on MACs. From my preliminary research, it looks like I can use macvlan networks to create containers which simulate a physical device on the network. If I add a DHCP server on this network, and the container runs a DHCP client will it get an IP from my DHCP server? Because docker itself sets an IP for each container afaik. How to circumvent this?

P.S. Many other articles I found online were extremely old and relied on pipework or a smaller subset of that script. I was just wondering if what I understood is correct and if it can be done in a less hacky way.