Docker Community Forums

Share and learn in the Docker community.

IP assigned by DHCP server


(Bobk48) #1

Greetings!
I would like to have any containers I run on my Ubuntu 15.10 host be automatically assigned a new IP address from the DHCP server (in my modem/router) on my home network. I searched for solutions on this forum, and so far found this similar post-


but no working solutions to the question asked in the post.
If this is an unusual or deprecated technique, for whatever reason, I would like to know explicitly why. And also have some usual and acceptable alternative technique suggested by experienced users of Docker.
In my limited experience doing research into this topic, particularly in the Docker tutorial, it seems that ports on the container can be mapped with -p to ports on the host. Also, because Docker OS-level virtualisation is different from VirtualBox virtualisation, I understand that there is a theoretical difference between doing what is done in VirtualBox (bridge network adapter) and what is acceptable and usual in Docker.
I would appreciate any and all feedback the experienced users and developers of Docker have on this subject.
Thanks!
Sincerely,
Robert M. Koretsky

OMG, I answered my own question!


(Dkalenscher) #2

I am looking for a similar issue here. Anyone?


(Archimedes Trajano) #3

Why not just make the swarm nodes DHCP and let it route using the overlay network to the appropriate container?

In my home setup much similar to the OP, I have a home router and VirtualBox machines running in bridged mode to make it look like individual machines in the router each with a dedicate DHCP assigned address. I happen to have the DHCP_HOSTNAME set on CentOS so that the name is registered on the DHCP server that would allow me to access the server by name regardless of its IP address.