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

怎甘沉沦 提交于 2019-12-05 23:08:14

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/43394826/how-to-configure-a-docker-container-for-acquiring-dhcp-ip-s-from-dhcp-server-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!