Making dynamic enteries in /etc/hosts

Issue type: Discussion

OS Version/build: RHEL 7(Maipo)

App version:  Docker version 1.13.1, build 7f2769b/1.13.1

Steps to reproduce:

I have a standalone containerA, that needs to know resolve host names of remote applications that are running at present or would be started in future i.e. this container needs to resolve host name dynamically.

I tried “–net=host”, but it requires containerA to be restarted to reflect changes done in the docker hosts’ /etc/hosts.
I also tried mounting /etc/ to the container with read only access. The problem with this approach was that /etc/hosts file inside the container did not change initially when the container was started. /etc/hosts on docker host had to be restarted so that the changes are reflected inside.

Is there any solution for this except for writing some trigger script?