Arun POONIA
Arun POONIA

Reputation: 41

Running DHCP renew lease command from Docker Alpine Container

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

Answers (3)

Abdull
Abdull

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

arcus
arcus

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

Arun POONIA
Arun POONIA

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

Related Questions