
Basic Docker Container Linking with Node, Redis and RethinkDB - spoxrHQ
http://blog.spoxr.com/basic-docker-container-links/
======
jon-wood
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.

~~~
jacques_chester
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](https://github.com/cloudfoundry-incubator/lattice)

------
mjhea0
Nice!

I have a similar blog post/slides > [http://mherman.org/blog/2015/03/06/node-
with-docker-continuo...](http://mherman.org/blog/2015/03/06/node-with-docker-
continuous-integration-and-delivery/)

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

~~~
spoxrHQ
Thanks! This is exactly what I'm looking for.

~~~
mjhea0
Cheers!

------
pavlov
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?

~~~
virulent
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.

~~~
theod
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](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.

------
reustle
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.

~~~
theod
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](https://github.com/docker/docker/issues/6350).

Also, the network model is being revamped via
[https://github.com/docker/docker/issues/9983](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.

