Docker Community Forums

Share and learn in the Docker community.

Updating Network Interfaces on Docker Host from Docker Container -- DHCP Renew Lease


#1

Manage Network Interfaces on Docker Host

Hi, I am trying to manage network interfaces on docker host from docker container. There are two scenarios, first is static and second is dhcp.

  • I am able to assign static ip to interface and update /etc/network/interfaces.d/ifcfg-eth*.cfg file using application running in container
  • I am able to update file with dhcp config /etc/network/interfaces.d/ifcfg-eth*.cfg but it looks like i need to renew lease if I am not planning to reboot the VM. How can I achieve that from container ?

Command Used to Create Container:

docker run --net=host --cap-add=NET_ADMIN -v /etc/network/:/mnt/network -p 8080 -d ubuntu_network

Command used to renew from Container:

dhclient eth1 but it looks like dhcp package is not installed. I would like to know how can I approach to solve this ? Any help would be appreciated.


#2

i needed to run apk add dhcpd on container to managed dhclient form container.