1

How can I give IP DHCP for each container, when I docker run images based on Ubuntu?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Yuday
  • 4,171
  • 4
  • 16
  • 23

1 Answers1

1

The way to specify an IP address when creating a container using docker run is in the works (possibly for docker 1.10, February 2016) in issue 6743.

In order for user to specify a preferred address for the container, plan is to add an explicit --ip (--ip6) option to docker run to be used in conjunction with --subnet.
Your ipam (IP address management) driver will ultimately receive the user chosen address as parameter of the RequestAddress() call.

That means the built-in IPAM driver will honor the preferred IP option specified by the user.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I use ipv4 in mylocal intranet, please give an example for the provision of IP to container? – Yuday Dec 11 '15 at 06:52
  • @YudiDwiyanto it will be `docker run --ip ...` but not right now: only with docker 1.10 – VonC Dec 11 '15 at 07:05
  • Terus, bagaimana saya bisa memberikan IP secara DHCP melalui laptop lokal saya? Adakah caranya, sir? – Yuday Dec 11 '15 at 07:29
  • @YudiDwiyanto Sekarang, Anda dapat mencoba menggunakan pipa https://github.com/jpetazzo/pipework (saya tidak memiliki pengalaman langsung dengan hal itu, tapi itu memiliki bagian DHCP: https://github.com/jpetazzo/pipework#dhcp ) – VonC Dec 11 '15 at 07:32
  • @YudiDwiyanto Also, maybe this could help: http://stackoverflow.com/a/27002987/6309 – VonC Dec 11 '15 at 07:33
  • @YudiDwiyanto or this: https://goldmann.pl/blog/2014/01/30/assigning-ip-addresses-to-docker-containers-via-dhcp/ – VonC Dec 11 '15 at 07:33
  • Saya sudah mencoba [goldman](https://goldmann.pl/blog/2014/01/30/assigning-ip-addresses-to-docker-containers-via-dhcp/) namun gagal, tidak ada hasil – Yuday Dec 11 '15 at 07:52
  • Sekarang saya mencoba memahami [github.com/jpetazzo/pipework](https://github.com/jpetazzo/pipework) – Yuday Dec 11 '15 at 07:54
  • @YudiDwiyanto Maka saya tidak memiliki solusi dengan docker 1,9, hanya dengan masa depan buruh pelabuhan 1.10. – VonC Dec 11 '15 at 07:55
  • jadi, menunggu docker versi 1.10, sir? – Yuday Dec 11 '15 at 08:27
  • @YudiDwiyanto Ya (Februari 2016), atau mencoba membangun eksperimental buruh pelabuhan (https://blog.docker.com/2015/06/experimental-binary/) – VonC Dec 11 '15 at 08:30