Orchestrating Distributed Solutions with Docker Swarm

You can run Docker on a single PC, which is what I've done so far in this book, and it's how you would work with Docker in development and basic test environments. In more advanced test environments and in production, a single server isn't suitable. For high availability and to give you the flexibility to scale your solutions, you need multiple servers running as a cluster. Docker has cluster support built into the platform, and you can join several Docker hosts together using Docker Swarm mode.

All the concepts you've learned so far (images, containers, registries, networks, volumes, and services) still apply in swarm mode. Docker Swarm is an orchestration layer. It presents the same API as the standalone Docker Engine, with additional functions to manage aspects of distributed computing. When you run a service in swarm mode, Docker determines which hosts to run the containers on; it manages secure communication between containers on different hosts, and it monitors the hosts. If a server in a swarm goes down, Docker schedules the containers it was running to start on different hosts to maintain the service level of the application.

Swarm mode has been available in Docker since version 1.12, released in 2015, and provides production-hardened enterprise-grade service orchestration. All communication in a swarm is secured with mutual TLS, so network traffic between nodes is always encrypted. You can store application secrets securely in the swarm, and Docker presents them only to those containers that need access. Swarms are scaleable, so you can easily add nodes to increase capacity or remove nodes for maintenance. Docker can also run automated rolling service updates in swarm mode, so you can upgrade your application with zero downtime.

In this chapter, I'll set up a Docker Swarm and run NerdDinner across multiple nodes. I'll start by creating individual services and then move on to deploying the whole stack from a Compose file. You'll learn all about:

  • Creating a swarm and managing nodes
  • Creating and managing services in swarm mode
  • Managing application configuration in Docker Swarm
  • Deploying stacks to Docker Swarm
  • Deploying updates with zero downtime
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.189.23