LAN DHCP assigned ipv4 and ipv6 for each container


Background :
I want to run multiple containers like new devices on the LAN and want to control them with my phone.
I already have a DHCP server to offer IPs.

Goal :
For each container I would like a dynamic DHCP assigned ipv4 and ipv6 without giving any IP informations of the LAN.
I want a container getting his IP like the host at his first connexion or like new device on the LAN.

Ubuntu for host and containers.


Your goal does not allign with doker’s feature set.

Non of the solutions I am aware of work without knowing details about your network, neither for ipv4 and especialy not with ipv6.

I am aware that a docker MACVLAN network would at least allow to use an ip-range within your LAN subnet for your conatiners, but docker will still try to provide ips for them using its own dhcp server - the recommendation is to use an ip-range outside your networks dhcp servers ip-range.

When it commes to ipv6, you will have to configure a fixed prefix in /etc/docker/daemon.json in order to have ipv6 addresses.