https://hub.docker.com/r/networkboot/dhcpd/
The most common use-case is to provide DHCP service to the host network of the machine running Docker. For that you need to create a configuration for the DHCP server, start the container with the --net host docker run option and specify the network interface you want to provide DHCP service on.
Create data/dhcpd.conf with a subnet clause for the specified network interface. If you need assistance, you can run docker run -it --rm networkboot/dhcpd man dhcpd.conf
for a description of the configuration file syntax.
Run docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd net0
. dhcpd will automatically start and display its logs on the console. You can press Ctrl-C to terminate the server.
set the interfaces static address sudo ifconfig net0 172.17.1.1
then add a default route to your local machine sudo route add -net 172.17.1.0/32 gw 172.17.1.1 netmask 255.255.255.0
so that you can reach devices that have been assigned addresses from the dhcp server.
now you can run the dhcp server docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd net0