Forrest logo
back to the docker tool

docker:tldr:75727

docker: Remove a worker from the swarm (run inside the worker node).
$ docker swarm leave
try on your machine

The command docker swarm leave is used to make a node leave a Docker swarm.

Docker swarm is a feature of Docker that allows you to create and manage a cluster of Docker nodes, known as a swarm. A swarm is a self-organizing and self-managing collection of Docker nodes that are used to run containerized applications.

When you execute docker swarm leave on a node that is part of a Docker swarm, it triggers the node to leave the swarm. This means that the node will no longer be part of the swarm and will no longer participate in the swarm management activities.

Leaving the swarm can be intentional, such as when you want to remove a node from the swarm cluster, or it can be accidental, such as when a node loses connection to the swarm manager. In either case, the command is used to initiate the process of leaving the swarm.

Once a node leaves the swarm, it can no longer participate in the swarm management activities, such as scheduling containers and distributing them across the swarm. However, the containers that were running on the node at the time it left the swarm will continue to run.

To rejoin the swarm, the node needs to execute the docker swarm join command and provide the necessary information, such as the address of the swarm manager and the join token, which is used to verify that the node is authorized to join the swarm.

Overall, the docker swarm leave command is used to remove a node from a Docker swarm, making it no longer part of the swarm cluster and stopping its participation in swarm management activities.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool