IT用語辞典

Glossary Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Docker Swarm - definition & overview

In this article
What is a Docker Swarm?
What is Docker Swarm used for?
Docker Swarm definitions
What are Docker Swarm nodes?
Docker Swarm benefits: do I need Docker Swarm?
Monitor and analyze your Docker containers with Sumo Logic
FAQs
What is a Docker Swarm?
What is Docker Swarm used for?
Docker Swarm definitions
What are Docker Swarm nodes?
Docker Swarm benefits: do I need Docker Swarm?
Monitor and analyze your Docker containers with Sumo Logic
FAQs

What is a Docker Swarm?

A Docker Swarm is a container orchestration tool running the Docker application. It has been configured to join together in a cluster. The activities of the cluster are controlled by a swarm manager, and machines that have joined the cluster are referred to as nodes.

Key takeaways

  • A Docker Swarm is a group of either physical or virtual machines that are running the Docker application and that have been configured to join together in a cluster.
  • The activities of the cluster are controlled by a swarm manager, and machines that have joined the cluster are referred to as nodes.
  • One of the key benefits associated with the operation of a docker swarm is the high level of availability offered for applications.
  • Docker Swarm lets you connect containers to multiple hosts similar to Kubernetes.
  • Docker Swarm has two types of services: replicated and global.

What is Docker Swarm used for?

In a Docker Swarm, there are typically several worker nodes and at least one manager node that is responsible for handling the worker nodes' resources efficiently and ensuring that the cluster operates efficiently. Docker Swarm is still included in docker-ce, but there is no longer a software-as-a-service for Docker Swarm.

Explore: Kubernetes & Docker

Learn More

Business Applications

Docker Swarm definitions

To contextualize our understanding of a Docker Swam, let's take a step back and define some of the more basic terms surrounding containers and the docker application.

Docker is a software platform that enables developers to easily integrate containers into the software development process. The Docker platform is open source and available for Windows and Mac, making it accessible for developers working on a variety of platforms. The application provides a control interface between the host operating system and containerized applications.

The main focus of the docker application is containers and their utilization and management in the software development process. Containers allow developers to package applications with all of the necessary code and dependencies for them to function in any computing environment. As a result, containerized applications run reliably when moved from one computing environment to another. In the docker application, a container is launched by running an image.

An Image is a package of executable files containing all the code, libraries, runtime, binaries and configuration files necessary to run an application. A container can be described as the runtime instance of an image.

A Dockerfile is a name given to the type of file that defines the contents of a portable image. Imagine you were going to write a program in the Java programming language. Your computer does not understand Java independently, so you'll need a way to convert your code into machine code. The libraries, configuration files, and programs needed to do this are collectively called the "Java Runtime Environment (JRE)." In Docker, all of these assets would be included in the Dockerfile.

So, instead of installing the JRE onto your computer, you could download a portable JRE as an image and include it in the container with your application code. When the application is launched from the container, all of the resources necessary to run smoothly will be in the isolated containerized environment.

The difference between Docker Swarm and Docker Compose is that Compose configures multiple containers in the same host. Docker Swarm is different in that it is a container orchestration tool. This means that Docker Swarm lets you connect containers to multiple hosts, similar to Kubernetes.

What are the two types of Docker Swarm mode services?

Docker Swarm has two types of services: replicated and global.

Replicated services: Swarm mode replicated services function based on a specified number of replica tasks that the Swarm manager assigns to available nodes.

Global services: Global services function by using the swam manager to schedule one task to each available node that meets the services constraints and resource requirements.

What are Docker Swarm nodes?

A Docker Swarm is comprised of a group of physical or virtual machines operating in a cluster. When a machine joins the cluster, it becomes a node in that swarm. In a Docker Swarm, there are typically several worker nodes and at least one manager node that is responsible for handling the worker nodes' resources efficiently and ensuring that the cluster operates efficiently. Docker Swarm's load balancer runs on every node and is capable of balancing load requests across multiple containers and hosts.
The docker swarm function recognizes three different types of nodes, each with a different role within the docker swarm ecosystem:

Docker Swarm manager node

The primary function of manager nodes is to assign tasks to worker nodes in the swarm. Manager nodes also help to carry out some of the managerial tasks needed to operate the swarm. Docker recommends a maximum of seven manager nodes for a swarm.

Docker Swarm leader node

When a cluster is established, the Raft consensus algorithm is used to assign one of them as the "leader node." The leader node makes all of the swarm management and task orchestration decisions for the swarm. If the leader node becomes unavailable due to an outage or failure, a new leader node can be elected using the Raft consensus algorithm.

Docker Swarm worker node

In a docker swarm with numerous hosts, each worker node functions by receiving and executing the tasks that are allocated to it by manager nodes. By default, all manager modes are also worker nodes and are capable of executing tasks when they have the resources available to do so.

Docker Swarm benefits: do I need Docker Swarm?

Here are three simple reasons why companies use Docker Swarm:

Leverage the power of containers

Developers love using Docker Swarm because it fully leverages containers' design advantages. Containers allow developers to deploy applications or services in self-contained virtual environments, a task that was previously the domain of virtual machines. Containers are proving a more lightweight version of virtual machines, as their architecture allows them to make more efficient use of computing power.

Docker Swarm helps guarantee high service availability

One of the main benefits of Docker Swarms is increasing application availability through redundancy. To function, a docker swarm must have a swarm manager that can assign tasks to worker nodes. By implementing multiple managers, developers ensure the system can continue functioning even if one of the manager nodes fails. Docker recommends a maximum of seven manager nodes for each cluster.

Automated load-balancing

Docker Swarm schedules tasks using various methodologies to ensure that there are enough resources available for all of the containers. Through a process that can be described as automated load balancing, the swarm manager ensures that container workloads are assigned to run on the most appropriate host for optimal efficiency.

Monitor and analyze your Docker containers with Sumo Logic

Traditional Linux-based tools that are designed to run on a single host and rely on analyzing log files on disk don’t scale well to multi-container clustered applications. Unless they are written to a data volume, they don’t monitor single container apps well because disk content is not persisted when containers are shut down.

Companies need a centralized approach to log management using container-aware monitoring tools.

Sumo Logic delivers a comprehensive strategy for continuous monitoring of Docker infrastructures. Correlate container events, configuration information, and host and daemon logs to get a complete overview of your Docker environment.

Explore how Sumo Logic helps companies visualize their entire Docker ecosystem––from code to deployment.

Monitor and analyze Docker containers

See how Sumo Logic helps you monitor, troubleshoot and analyze your Docker environment in real time.

FAQs

https://www.sumologic.com/blog...What's the difference between a Docker machine and a Docker hub?

Docker Machine serves as a provisioner for Dockerized environments, enabling users to create and manage Docker hosts on local machines or cloud platforms effortlessly. It automates setting up Docker instances, streamlining workflow and enhancing efficiency. Docker Hub functions as a cloud-based registry service for Docker images. It is a repository where developers can store, share, and access Docker images privately or publicly. Docker Hub is a central hub for collaboration and distribution of containerized applications.

What are the key benefits of using Docker Swarm for container orchestration?

  • Easy scaling of containerized applications by adding or removing nodes

  • It ensures high availability of applications

  • Built-in load-balancing capabilities

  • Simplified service discovery within the cluster, allowing containers to communicate with each other using service names

  • Support for rolling updates, enabling seamless deployment of new container versions without downtime

  • Secure communication between nodes and containers

  • Easy deployment

  • Deployment flexibility

What security features does Docker Swarm offer for containerized applications?

What are the typical use cases for Docker Swarm in a DevOps workflow?

Docker Swarm is commonly used in DevOps workflows to orchestrate containerized applications and ensure high availability, load balance and scale across multiple nodes. Its use cases include simplifying deployment, managing microservices architecture, and improving resource utilization. By leveraging Docker Swarm, teams can automate deployment processes, enhance resilience, and streamline continuous integration and continuous deployment (CI/CD) pipelines. This solution facilitates seamless scaling, fault tolerance and efficient resource allocation, making it a valuable asset in modern DevOps practices.