Search code examples
linuxdockernetwork-programmingdocker-network

Docker network interface not released to host name space


We are running a docker container like this

docker run -d --network=none --name test -p 1642:4000 test .

After that , assigning a network interface to docker container from the host OS like this .

sudo pipework --direct-phys ens1f1.955 -i ens1f1.955 <container_id> dhclient-f U:ens1f1.955

After doing this , when we kill the container forcefully , if i run netstat -i on the host , the interface ens1f1.955 is not showing up . Can someone help ?


Solution

  • Found that the issue was because a dhclient process was holding onto the interface and hence wasn't getting released . Tried killing the dhclient process and do a network restart and everything was going well . Alternative to network restart is to do ifup