Creating and managing services in swarm mode
In the previous chapter, you saw how to use Docker Compose to organize a distributed solution. In a Compose file, you define the parts of your application as services using networks to connect them together. The same service concept is used in swarm mode--a service runs an application image across one or more containers called replicas. With the Docker command-line, you can create services on the swarm, and the swarm manager will create the replicas as containers.
I'll deploy the NerdDinner stack by creating services. All the services will run in the same Docker network, and in swarm mode, Docker has a special type of network called overlay networking. Overlay networks are virtual networks that span multiple physical hosts, so containers running on one swarm node can reach containers running on another node. Service discovery works in the same way; containers access each other by the service name, and Docker directs them to a container.
To create...