📜  docker swarm list (1)

📅  最后修改于: 2023-12-03 15:14:46.185000             🧑  作者: Mango

Introduction to docker swarm list

docker swarm list is a command in Docker that allows you to list all the nodes in a swarm cluster. It is a useful tool for developers who work with Docker swarm.

When you run the docker swarm list command, Docker returns a list of nodes in the cluster, along with their status, availability, and other information. This information can help you diagnose errors or troubleshoot issues with your swarm cluster.

Usage

To use docker swarm list, you must have Docker installed on your machine and be connected to a swarm cluster. Here's an example of how to run the command:

$ docker swarm list

This will return a list of nodes in the cluster, similar to the following:

ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
u46axu1cvgytwrbxjmno4axf8     node1               Ready               Active              Leader              19.03.5
b5663xpzfyc4vhs3d0b33z16u     node2               Ready               Active                                  19.03.5
v4i91i512l2xmap5gq57y0p82     node3               Ready               Active                                  19.03.5

The columns in the output include:

  • ID: The unique ID assigned to each node in the cluster.
  • HOSTNAME: The hostname of the node.
  • STATUS: The current status of the node (e.g. "Ready" or "Down").
  • AVAILABILITY: The availability status of the node (e.g. "Active" or "Drain").
  • MANAGER STATUS: Whether the node is a manager or not, and if it is the leader.
  • ENGINE VERSION: The version of Docker that the node is running.
Conclusion

docker swarm list is a powerful command that provides valuable information about the nodes in a swarm cluster. Whether you're a seasoned Docker developer or just getting started with swarm, this tool is an essential part of your toolkit.