News for hackers. Stuff that matters.
Re:Basic Docker Container Linking with Node, Redis and Rethi... by jon-wood on Sunday March 08, 2015 @08:22AM (#9165361)
Unfortunately in my experience unless your building a local development environment, in which everything can be started and stopped at once, and it all runs on the same machine, container linking is effectively useless.

I think Docker Swarm has fixing this on the roadmap, but for now I think Kubernetes is the only thing to take into account the fact you'll probably want to have more than one node in a Docket cluster.

Re:Basic Docker Container Linking with Node, Redis and Rethi... by jacques_chester on Sunday March 08, 2015 @09:31AM (#9165515)
Cloud Foundry has an incubator project -- Lattice -- for this purpose as well[0].

It's an extraction and repackaging of next-gen Cloud Foundry components.

[0] https://github.com/cloudfoundry-incubator/lattice

Re:Basic Docker Container Linking with Node, Redis and Rethi... by theod on Sunday March 08, 2015 @12:59PM (#9166187)
Please refer to https://github.com/docker/docker/issues/9983. The Networking concepts are completely revamped using this proposal. Links are being replaced with concepts like Network and endpoints. State Distribution and Service Discovery can also be used by the Network plugins to provide an effective multi-host networking solution.
Re:Basic Docker Container Linking with Node, Redis and Rethi... by spoxrHQ on Sunday March 08, 2015 @02:25PM (#9166545)
Yes, I agree there are outstanding issues with my method. I was having trouble locating an article that 'connected the dots'.

The main goal last night was was fast, quick and dirty. Hopefully, I'll get a chance to write about more complex approaches in-depth going forward.

Re:Basic Docker Container Linking with Node, Redis and Rethi... by mjhea0 on Sunday March 08, 2015 @10:37AM (#9165691)
Nice!

I have a similar blog post/slides > http://mherman.org/blog/2015/03/06/node-with-docker-continuo...

You should look at Docker Compose (formerly Fig) for container linking. Much easier.

Re:Basic Docker Container Linking with Node, Redis and Rethi... by spoxrHQ on Sunday March 08, 2015 @02:22PM (#9166533)
Thanks! This is exactly what I'm looking for.
Re:Basic Docker Container Linking with Node, Redis and Rethi... by mjhea0 on Sunday March 08, 2015 @03:35PM (#9166864)
Cheers!
Re:Basic Docker Container Linking with Node, Redis and Rethi... by pavlov on Sunday March 08, 2015 @06:38AM (#9165217)
Looks interesting, but I don't really know anything about Docker except the elevator pitch so I don't understand what's achieved here.

Can some explain what is container linking?

Re:Basic Docker Container Linking with Node, Redis and Rethi... by virulent on Sunday March 08, 2015 @09:02AM (#9165439)
Ports inside a container aren't exposed publicly unless explicitly done.

Container linking lets containers connect to each other without exposing ports via docker.

The "linking" is exposed to the container via an /etc/hosts entry, so e.g. --link test-db:db adds "a.b.c.d db" to /etc/hosts which can be used by anything that needs it.

As mentioned by jon-wood, the simple linking approach only works with containers on the same machine unfortunately.

Re:Basic Docker Container Linking with Node, Redis and Rethi... by theod on Sunday March 08, 2015 @01:02PM (#9166194)
The concepts of Linking are being revisited via the network revamp proposal with the help of Network Plugins : https://github.com/docker/docker/issues/9983. With the plugins providing State Distribution and Service Discovery the containers can be effectively linked across multi-host network.
Re:Basic Docker Container Linking with Node, Redis and Rethi... by reustle on Sunday March 08, 2015 @04:17AM (#9164996)
Have you managed to get this setup to continue working after one of the containers restarts? That is a problem with container linking I have yet to find an answer for.
Re:Basic Docker Container Linking with Node, Redis and Rethi... by theod on Sunday March 08, 2015 @01:05PM (#9166209)
Some of the container restart issues related to Links were resolved in 1.4+ & 1.5 releases. Please refer to the thread https://github.com/docker/docker/issues/6350.

Also, the network model is being revamped via https://github.com/docker/docker/issues/9983 to provide a more flexible plugins based Networking system which can also provide multi-host solution that is more powerful than the existing single-host multi-container linking system.

Re:Basic Docker Container Linking with Node, Redis and Rethi... by spoxrHQ on Sunday March 08, 2015 @02:21PM (#9166528)
Very good question, sorry I don't have a good enough answer for that right now. I only needed this setup for testing and not really a production environment, so data persistence wasn't a requirement.

Once I have a satisfactory approach, I'll post a solution.

Re:Basic Docker Container Linking with Node, Redis and Rethi... by wernerb on Sunday March 08, 2015 @07:32AM (#9165276)
You can use an ambassador such as listed here [0].

[0] https://docs.docker.com/articles/ambassador_pattern_linking/