Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure a Docker container for acquiring DHCP IP/s from dhcp server running on ESX

My host is SLES12 VM running on an ESX server. VM Host has interfaces which acquire DHCP IPs from the DHCP server running on ESX.

In my docker container (docker image: opensuse) I am running a NFS server and hence need external access. I want the container to acquire dhcp IP from the dhcp server running on ESX (just like my Host VM gets).

I have tried pipework but could not get it working. Here is what I did:

  1. Enabled Promiscuous mode on ESX. Created new bridge (br1) and
    attached it to Host interface eth0.

  2. Using pipework added a new interface (eth1) in Docker container with an IP address using this command pipework br1 $CONTAINERID 0/0

  3. After I tried assigning DHCP IP to the new interface (eth1) of the container, using the command pipework eth1 $CONTAINERID dhclient

    But got the below error: RTNETLINK answers: File exists

  4. To resolve this I flushed the eth1 device in the container and ran the command again. I observe that my docker daemon crashed. Docker version: 1.12.3 (both client and server).

Please let me know what I am missing here. I want my container's interface/s to acquire the DHCP IPs from DHCP server running on ESX.

like image 590
Anupam Avatar asked Apr 13 '17 14:04

Anupam


1 Answers

You will need to create a docker network with the macvlan or ipvlan driver. Then you will need to use the DHCP IPAM driver (IPAM stands for IP Address Management).

Here is a gist with some explanations of how to do something similar: https://gist.github.com/nerdalert/3d2b891d41e0fa8d688c

like image 75
smaftoul Avatar answered Oct 19 '22 22:10

smaftoul