Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Add support for container ip dns entry #298

Open
teodor-pripoae opened this issue Feb 25, 2015 · 4 comments
Open

Add support for container ip dns entry #298

teodor-pripoae opened this issue Feb 25, 2015 · 4 comments

Comments

@teodor-pripoae
Copy link
Contributor

Hi,

I'm trying to run two containers for an erlang application, which requires them to know docker ips of each other. Basically this two containers need access to each other for port 4369 (fixed port) in order to create a cluster. 1-#{system-name}.dev.azk.io maps to ip of the docker bridge. Is there any option to set the dns name to the container ip ?

I can not map port 4369 to other port on docker bridge, since erlang expects this port and doesn't seem to have any configuration for it.

@lucasfais
Copy link
Contributor

Unfortunately, that isn't supported yet. Like you said, isn't possible to map two containers to the same port.

More than that, the ideal solution is a way to create a virtual network between some specific containers, in a way that they behave like completely different nodes.

We plan to address this issue at some point in the future, so I will keep this issue opened.

@teodor-pripoae
Copy link
Contributor Author

Hi,

Is there any option to insert/remove records from the dns service used by azk ? This way I can wrap the init function in my container to something like this:

IP=$(hostname -i)
# create dns entry my-app-1.internal.dev.azk.io => $IP
run_my_app
# delete dns entry my-app-1.internal.dev.azk.io

@fearenales
Copy link
Contributor

Hi @teodor-pripoae !

You can try to do the following:

  1. Create a file named /etc/resolver/my-app-1.internal.dev.azk.io with content:
nameserver 127.0.0.1:5353
  1. Run dnsmasq in 5353 port (feel free to change it if needed):
dnsmasq --bind-interfaces -p 5353 --no-daemon --address=/my-app-1.internal.dev.azk.io/$IP

Now on, when you hit my-app-1.internal.dev.azk.io, the dnsmasq will be responsible to resolve it to the desired IP.

Please let me know if this works for you.

@teodor-pripoae
Copy link
Contributor Author

Thanks, but I don't think this approach helps me.

I need to be able to scale the service to 2-3 instances and connect them by internal ip (172.17.42.100, 172.17.42.123 and 172.17.42.125) for example, so I can test clustering while developing the erlang service.

Anyway, sorry for the trouble, I think I also need to know how many instances are running for the same service after the service started in order to cluster them properly, so I will use something like etcd or consul.

Thank you very much !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants