Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does Docker Swarm mean?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces what Docker Swarm means. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

Docker Swarm

Docker Swarm is one of the official Docker projects, which uses the built-in cluster management and orchestration tools of the Docker engine built by SwarmKit to provide Docker container cluster services. It is the core solution of Docker official support for container cloud ecology. With it, users can encapsulate multiple Docker hosts into a single large virtual Docker host, and quickly create a set of container cloud platform.

Node

The host running Docker can initialize a Swarm cluster or join an existing Swarm cluster, so that the host running Docker becomes the node node of an Swarm cluster.

Nodes are divided into management node manager and work node worker

The management node is used for the management of Swarm cluster, and the docker swarm command can only be executed in the management node.

The work node is the task execution node, and the management node issues the service service to the work node for execution.

Services and tasks

Task task is the smallest scheduling unit in Swarm and is currently a single container.

A service service is a collection of tasks, and a service defines the properties of a task

There are two modes of service:

Replicated services runs a specified number of tasks on each node according to certain rules

Global services runs one task on each worker node

These two modes can be specified by the-mode parameter of docker service create

Docker Swarm cluster building

Use docker swarm init on the Docker server to initialize a Swarm cluster:

Docker swarm init-advertise-addr 192.168.xx.xxx

The node that executes the docker swarm init command automatically becomes the management node, and after the command is executed, the command to add the work node will be printed. After the command is copied to the work node, the work node can be added to the Swarm cluster. If you forget the command to add a work node, you can view it through "docker swarm join-token worker". When adding a work node, you may fail to add it. You can check the firewall first. Swarm nodes communicate with each other through TCP/UDP. Make sure that port 2377, 794, and 4789 can communicate, and the test environment can turn off the firewall and restart the Docker service.

With such a management node, the minimum Swarm cluster of the two working nodes is built.

Swarm Cluster deployment Service

Services in the Swarm cluster can be managed using the docker service command, which can only be run on the management node.

Create a nginx service in the Swarm cluster, and before creating the service, make sure that each node:

Docker service create-- replicas 3-p 80:80-- name nginx nginx:latest

Use the "docker service ls" and "docker service ps" commands to view running services

After the service starts normally, you can enter the IP of any node to access the nginx service

Swarm graphical resource management tool

Portainer is a Docker graphical management tool, which provides detailed status display panel, rapid deployment of application templates, basic operations of containers / images / data volumes, viewing and display of event logs, centralized management of Swarm clusters and services, and user management.

Run portainer:

# pull the image

Docker pull portainer/portainer

# run

Docker run-d-p 9000UR 9000\

-- name portainer-- restart=always\

-v / var/run/docker.sock:/var/run/docker.sock\

Portainer/portainer

After the portainer container starts, you can browse and access it. You need to set the admin user password to log in for the first time.

The portainer container runs on the Swarm management node. After selecting the local connection, go to the following page

Click local to go to the details page, which contains Docker images, containers, data volumes, Swarm cluster information on the host, etc.

Swarm Cluster Information

Service information, where you can create, expand, delete, etc.

The above is all the contents of this article "what does Docker Swarm mean?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report