Linking Containers Using Multiple Docker Hosts

Greetings Programs,

I’m new to Docker and really working hard to further my understanding of how all this is supposed to work. I have an existing application that I have successfully “containerized”. I have it working within a Docker container and it is great. My issue comes with scaling it. I stood up a 2nd docker host, deployed my application, but everything I’m doing is based on publishing ports on the Docker Host itself using Docker run -p.

Is there someway to link my containers together across multiple Docker hosts? All the documentation about linking that I have been able to find makes the assumption that there is just one Docker host. Does that makes sense? Preferably, I would like to be able to do this without using Docker Machine/Compose if possible. Is it possible?

Thank you so much for any insights offered.

EM.

There is a project called swarm being built to enable multiple docker daemons across hosts to work together as one. Docker has experimental support for alternate networking backends, but I haven’t played with it just yet. In the very near future, I suspect that multi-host links will be a quick tutorial.

Until all those pieces are in place, --link is specifically for containers on the same host. You can mimic some of what link does by manually writing out the environment variables you need. Another pattern is the ambassador pattern. The ambassador essentially acts as a proxy to where the service really runs, but gives you something to --link to.

/Jeff

swarm - https://docs.docker.com/swarm/
experimental networking - https://blog.docker.com/2015/07/docker-tutorial-13-experimental-networking/
ambassador pattern - https://docs.docker.com/articles/ambassador_pattern_linking/