InconceivableDuck / Nodevember

55 stars 24 forks source link

Linking docks together #1

Open klodha opened 9 years ago

klodha commented 9 years ago

Hi, I happen to watch your presentation over YouTube yesterday. Really very useful and focused on doing it rather than reading. Following the same, I was able to setup docks with mongo, redis and node js. One query I have regarding the same is as docker IP addresses are volatile, how we should link mongo, redis with node? Should we use ENV option or is there any other recommended method.

InconceivableDuck commented 9 years ago

You are exactly right and networking between containers is a tough one. Docker link is brittle and the IP will change when the container is cycled and break the link. At this moment in time, there is no great work-around. Tools like consul.io add a service discovery layer that will help. Docker networking is on the experimental branch, which will eventually be part of Docker itself and solve a lot of these problems: https://github.com/docker/docker/blob/master/experimental/networking.md

What we do at Modulus is expose the ports to the host then use DNS that points back to the host itself. We don't use Docker link or any other service discovery layer.

klodha commented 9 years ago

Thanks for quick revert :)

Could you please share the process of exposing the ports to the host then use DNS that point back to host itself.

Following your slides, I was able to launch 1 node instance and 1 rabbitmq instance. On my local machine, node container is linked to redis and each page view is incrementing a counter in redis cache. However on local network I can not access node code (as Docker IP is different LAN network ie. not 192.168.1.x). I want to allow other members on team to be able to hit node container using their web browser.

Regards, K

On 06-Aug-2015, at 12:29 am, InconceivableDuck <notifications@github.com mailto:notifications@github.com> wrote:

You are exactly right and networking between containers is a tough one. Docker link is brittle and the IP will change when the container is cycled and break the link. At this moment in time, there is no great work-around. Tools like consul.io add a service discovery layer that will help. Docker networking is on the experimental branch, which will eventually be part of Docker itself and solve a lot of these problems: https://github.com/docker/docker/blob/master/experimental/networking.md https://github.com/docker/docker/blob/master/experimental/networking.md What we do at Modulus is expose the ports to the host then use DNS that points back to the host itself. We don't use Docker link or any other service discovery layer.

— Reply to this email directly or view it on GitHub https://github.com/InconceivableDuck/Nodevember/issues/1#issuecomment-128110472.