How to configure a Docker container to obtain DHCP IP addresses from a dhcp server running on ESX

My host is VM SLES12 running on an ESX server. VM Host has interfaces that receive DHCP IP addresses from a DHCP server running on ESX.

In my docker container (docker image: opensuse) I am running an NFS server and therefore need external access. I want the container to acquire the dhcp IP address from the dhcp server running on ESX (like my host machine).

I tried pipework but couldn't get it to work. Here is what I did:

  • Enabled Intermediate mode in ESX. Created a new bridge (br1) and
    attached it to the host eth0 interface.

  • Using pipework added a new interface (eth1) to the Docker container with an IP address using this pipework br1 $CONTAINERID 0/0

  • After I tried to assign a DHCP IP address to the new interface (eth1) container using pipework eth1 $CONTAINERID dhclient command

    But the following error RTNETLINK answers: File exists : RTNETLINK answers: File exists

  • To solve this problem, I dropped the eth1 device into the container and ran the command again. I watch my docker demon collapse. docker version: 1.12.3 (both client and server).

Please let me know what I'm missing here. I want my / s container interface to obtain DHCP IP addresses from a DHCP server running on ESX.

+7
docker docker-container esxi dhcp
source share
1 answer

You will need to create a docker network with the macvlan or ipvlan driver. You will then need to use the DHCP IPAM driver (IPAM means IP address management).

Here is the gist with some explanations on how to do something like this: https://gist.github.com/nerdalert/3d2b891d41e0fa8d688c

+1
source share

All Articles