Is it possible to assign a static public ip to a Docker Container?

前端 未结 3 1844
天涯浪人
天涯浪人 2021-01-28 02:38

I have been trying to assign one of my five public ip\'s to my docker container. It seems like this should be possible because of the nature of docker and its uses. I found this

3条回答
  •  温柔的废话
    2021-01-28 03:45

    Possible Solution but I can't test it right now. Please let me know if this is incorrect.

    Make virtual network interface with macvlan:

    See https://superuser.com/questions/175475/ip-address-alias-assigned-by-dhcp

    commands:

    ip link add dev macvlan0 link eth0 type macvlan #macvlan0 being the name of the v-card (lol)

    Connect container to virtual network interface with pipework:

    see https://github.com/jpetazzo/pipework/#connect-a-container-to-a-local-physical-interface

    commands:

    pipework macvlan0 $($containerid) dhcp

提交回复
热议问题