swarmexec › Docs › Volumes & prune schedule
Volumes & prune schedule_
Node-local volumes, seen and cleaned up cluster-wide.
On this page
volume ls — list volumes
Lists volumes across all nodes and which nodes hold each. Swarm volumes are
node-local, so the client queries every node and aggregates. Optional substring
name filter. Columns: VOLUME DRIVER NODES USED BY AGE
(plus SIZE with --size). AGE is compact:
3d4h up to 30 days, then 3mo / 4y.
| Flag | Default | Description |
|---|---|---|
--size | false | also compute each volume's on-disk size (slower: du per volume) |
--sort | name | sort by: name | nodes | used | age | size (size implies --size) |
--reverse | false | reverse the sort direction |
--connect-timeout | 10s | per-node connect timeout |
--json | false | output JSON instead of a table |
volume rm — remove a volume
Remove a volume on every node that holds it (--all) or on specific
nodes (--node, repeatable). One of the two is required.
| Flag | Default | Description |
|---|---|---|
--all | false | remove on every node that holds the volume |
--node | — | remove only on these nodes (repeatable) |
--force | false | pass docker's force flag |
-y, --yes | false | do not prompt for confirmation |
--connect-timeout | 10s | per-node connect timeout |
node ls / node prune / node update — the nodes
The Nodes tab on the command line, running
the same code. node ls lists every node — role, availability, state,
engine, running tasks, the volume count its agent reports (- when the
agent did not answer; --skip-agents does not ask) and the number of
labels; --json gives every field, the labels themselves included.
A node is named by hostname, id or a unique id prefix.
node prune is the TUI's node
prune: it shows what each category would free, as the agent last measured it,
then asks. Without --categories it sweeps the safe ones — stopped
containers, untagged images, build cache, unused local networks.
images (every unused image, those of services scaled to zero
included) and volumes (data, named volumes included) are pruned only
when named. Without a terminal and without --yes nothing is pruned; a
category that fails on the node is the exit code (125).
node update sets availability and labels. It applies
at once — a node has no rolling update. drain moves every task off
the node, so it asks first; active and pause apply
directly.
| Command / flag | Description |
|---|---|
node ls --json | JSON instead of the table; volumes is null where the agent did not answer |
node prune --categories | comma list of containers, images, dangling-images, buildcache, networks, volumes (images already includes dangling-images) |
node prune --containers-until | keep stopped containers this long after they stop (default 24h; 0 keeps none) |
node update --availability | active, pause or drain |
node update --label-add / --label-rm | add or change key=value / remove key; repeatable |
-y, --yes | do not prompt (prune, drain) |
node prune-schedule — the agents' prune schedule
Shows or sets the cluster-wide prune schedule.
show prints it with the next five runs; set changes only
the flags you give and enables the schedule. Saving updates the agent service, so
the agents restart one by one; the command asks first. It was the
top-level prune-schedule, which still works.
| Flag (set) | Default | Description |
|---|---|---|
--days | every day | mon,tue,… or ranges like mon-fri |
--start | 00:00 | first run of the day, HH:MM |
--times | 1 | runs per day (1–24), the day split evenly from --start |
--tz | UTC | IANA time zone of --days and --start |
--categories | containers,images,buildcache,networks | also dangling-images and volumes |
--containers-until | 24h | keep stopped containers this long after they stop; 0 keeps none |
--label-filter | — | only prune objects with these labels; - clears |
--disable | false | turn the schedule off and keep its settings |
-y, --yes | false | do not prompt before the agents restart |
See the recipe: free disk space on a schedule.