Connecting services: A WordPress example

The possibility of launching a bunch of replicated and load balanced containers is already a good start, but how about more complex application stacks, made of different interconnected containers?

In this case, you can link containers by calling them by name. As we just saw, the internal Swarm DNS server will guarantee a reliable name resolution mechanism. If you instantiate a service called nginx, you can just reference it as nginx and other services will resolve to the nginx Virtual IP (load balanced), hence accessing the distributed containers.

To demonstrate this with an example, we're now going to deploy the more classical of classics on Swarm: WordPress. You can run WordPress as a container, in fact ...

Get Native Docker Clustering with Swarm now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.