docker-node
Manage nodes in a Docker Swarm cluster
TLDR
List nodes in the swarm
List tasks running on one or more nodes, defaults to the current node
Display detailed information on one or more nodes
Promote one or more nodes to manager in the swarm
Demote one or more nodes from manager in the swarm
Remove one or more nodes from the swarm
Update metadata about a node, such as its availability, labels, or roles
SYNOPSIS
docker node COMMAND [OPTIONS] [ARG...]
PARAMETERS
accept
Accept a pending node registration
demote
Demote one or more nodes from manager
inspect
Display detailed info on one or more nodes
join-token
Manage join tokens for adding nodes
leave
Make node leave the swarm
ls
List nodes in the swarm
promote
Promote one or more nodes to manager
prune
Remove unused swarm resources
ps
List tasks on one or all swarm nodes
rm
Remove one or more nodes from swarm
update
Update node availability, labels, or role
DESCRIPTION
docker node is a subcommand of the Docker CLI used to administer nodes in a Docker Swarm cluster. Docker Swarm enables orchestration across multiple Docker hosts, forming a resilient cluster where services can be deployed and scaled. Nodes represent individual hosts: managers handle cluster state, scheduling, and leader election, while workers execute tasks assigned by managers.
This command provides essential operations like listing nodes with docker node ls, which shows ID, hostname, status, availability, manager status, and engine version. Inspect a node deeply with docker node inspect <node> to view configuration, status, spec, and manager details. Update nodes using docker node update to change availability (active, pause, drain), add/remove labels for scheduling filters, or adjust roles.
Other key functions include promoting workers to managers (docker node promote), demoting managers (docker node demote), removing nodes (docker node rm), viewing tasks on nodes (docker node ps), and managing join tokens for scaling the cluster. Commands like docker node prune clean up unused data, and docker node leave exits a node from the swarm.
Requires Docker running in swarm mode (initiated via docker swarm init). Most actions demand execution on a manager node with appropriate privileges. Ideal for production cluster management, troubleshooting, and maintenance.
CAVEATS
Requires swarm mode; most ops need manager node and admin access. Cannot run on standalone Docker.
COMMON OPTIONS
--filter key=value (ls, ps); --format string Go template output; -q,--quiet numeric IDs only; --no-trunc full IDs; --no-resolve skip IP resolution.
EXAMPLES
docker node ls
docker node update --label-add type=storage node1
docker node promote worker1
docker node ps --no-trunc
HISTORY
Introduced in Docker 1.12.0 (2016) with native Swarm mode, replacing legacy Swarm. Evolved with SwarmKit for better scalability.
SEE ALSO
docker-swarm(1), docker-service(1), docker-stack(1)


