Reputation: 41
I am trying to manage my container host interface(one of the interface) from docker container. I am able to change ip address and assign static ip to interface but it looks like when i am flushing ip address in case of dhcp, I need to renew the lease using dhclient eth1
which doesn't run inside container because there s no such package installed container. What would be best approach so I can renew lease ?
I am running container using docker run --net=host --cap-add=NET_ADMIN -v /etc/network/:/mnt/network -p 8080 -d ubuntu_network
command where ubuntu_network
is my custom application. Any help would be appreciated.
I couldn't find any relevant document for this.
I should be able to renew lease from container to container host interfaces.
Upvotes: 3
Views: 7702
Reputation: 27832
Within Alpine Linux, if the system is configured to obtain network configurations via DHCP, a DHCP refresh can be triggered with the following command:
/etc/init.d/networking restart
via https://wiki.alpinelinux.org/wiki/Configure_Networking#Activating_Changes_and_Testing_Connectivity
Upvotes: 1
Reputation: 91
This is a bit late, but running udhcpc
inside Alpine Linux seemed to work for me to get a new DHCP address.
Upvotes: 9
Reputation: 41
I had to run apt add dhclient
package on my container to run dhclient
command from container so interface can send a query to DHCP server for renewing lease.
Upvotes: 0