swarmexec › Docs › TUI: the Stacks/Services tab
TUI: the Stacks/Services tab_
Services and their containers, and everything you can do to them.
On this page
Stacks/Services tab
Tab 1, formerly labelled Containers. It is one tree, stack → service → container, and it is where exec, logs, port-forwarding, inspect and the service editors live.
In this part
The tab has more to it than fits one page. This page has its keys; the rest is split by what you are doing:
- The service tree — health, usage, stacks — what a row's colour, count and markers mean: replica and job counts, healthcheck colours, live CPU and memory, the
:latestversion annotation, and grouping by stack. - The security-risks overlay — the 🛡 marker, the eight spec checks behind it, and the ! overlay that lists them.
- Inspect a service or task — the i overlay: table, live stats and raw JSON, copying lines, and the networks with their VIPs, DNS names and containers.
- Edit a service & the env editor — the a actions menu: set the image version, diff, roll back, scale, force-update, remove, the placement diagnosis, the staged editors and the vim-style env editor.
Keys in the tree
| Key | Action |
|---|---|
| / | open the search bar (filters by service / container / node) |
| h l | fold / unfold, walking all three levels. h folds the row under the cursor — a stack folds the whole group, an expanded service folds its containers — and where there is nothing left to fold it steps out to the parent instead, so repeated presses walk up container → service → stack. l expands the row under the cursor, or descends to its first child when it is already open |
| Enter | on a container: open the action menu; on a service or a stack: expand / collapse it |
| s | toggle stack grouping — grouped tree ⟷ flat service list (see grouped by stack) |
| L | logs (capital L) — on a container its own logs, on a service the aggregated logs of all its tasks; on a stack row every container of every service in the stack, each line tagged [svc.slot] (or [svc@node] for a global service), starting from the last 50 lines each — like swarmexec logs --stack. Up to 64 containers; the (no stack) row is a grouping, not a stack, and opens nothing |
| ! | open the security-risks overlay for the whole service list (see security risks) |
| E | stack file — export the stack under the cursor, or compare a stack file against it (see stack export & diff); the footer lists it as E stack file. Remappable as stack_file |
| p | port-forward the task under the cursor — opens the Port Forward dialog (container port, local port, address; see the Forwards tab) |
| i | inspect the node under the cursor — a navigable overlay with a tabular summary; move the selection with ↑/↓ or j/k, y/Enter copies the selected line, a tab strip at the top names the three views and 1/2/3 select table / stats / raw daemon JSON directly while t cycles them (Esc/q/i closes). On a service the overlay also edits it: a opens the actions menu with every editor and action (ports, labels, networks, secrets, mounts, resources, placement, the why diagnosis, roll back, …); u version, d diff, s scale, f force-update and e env also work directly, and X removes it. All of it is on inspect and edit a service |
| X | remove a service straight from the tree (capital X, i.e. Shift+x) — no detour through the inspect overlay. What it acts on follows the row under the cursor: on a service row it removes that service; on a container row it removes that container's owning service, because a single task cannot be removed on its own — Swarm would immediately reschedule it; on a stack row it removes the whole stack, exactly what docker stack rm removes: every service, secret, config and network carrying that stack's com.docker.stack.namespace label. The confirm names the counts it found (“4 services, 2 secrets, 1 network”) before anything goes, and the networks are retried for a few seconds because a service's endpoints take a moment to drain after its tasks stop — docker stack rm gives up there and leaves the network behind. Whatever refuses is listed by name afterwards, so you know exactly what is left. The (no stack) row removes nothing: it is a display grouping, not a stack. It goes through the same confirm as the inspect X — it permanently deletes the service and stops all its tasks, cannot be undone, and afterwards offers to delete any now-orphaned secrets. Remappable as service_remove in keys.yaml (default X); the footer lists it in red as X remove and the ? overlay lists it too. The X inside the inspect overlay is unchanged |
The container action menu
The action menu offers logs, bash,
sh, shell as user… (prompts for a user/UID,
like docker exec -u, for images whose default user lacks the tools
or permissions you need), port forward (unavailable shells are
greyed out after a probe), and three container actions:
- inspect container (node-local) — the real
docker container inspectof the running container, fetched from its node's agent: state, exit code, OOM kill, restart count, the last health probes with their output, the container's own network endpoints (IP, MAC, aliases) and mounts, in the same overlay as i (table / stats / raw JSON). i on the tree shows the manager's task inspect, which cannot see any of that. The raw JSON includes the container's environment; the summary does not. - copy file out of container… and
copy file into container… — the two halves of
swarmexec cpon the container the cursor is on. Each asks two paths: what to copy, and where it goes. Nothing is needed inside the container, not eventar— the copy goes through the Engine's archive endpoint on the node, so it works with distroless and scratch images. The destination rules aredocker cp's: an existing directory receives the source under its own name, any other path is the name. Copying between two containers is on the command line only; picking a second container is a selection this UI has nowhere else. - copy container id — the full id to the clipboard (OSC52, like y).
- kill task (swarm reschedules it)
— after a confirm, the agent sends the container
SIGKILL; Swarm sees the task fail and starts a replacement per the service's restart policy. The answer to “replica 2 hangs” without a force-update of the whole service. Only swarm task containers can be killed.
A copy larger than 1 GiB is refused, the same cap
cp --max-size has; the command line is where a bigger one, an
owner-preserving -a or a followed symlink -L belongs.
There is no progress bar and no cancel key: the copy is bounded, and a progress
line that cannot be stopped would only be decoration — the notice says what
arrived.
Inspect and kill need an agent from the release that introduced them; an older
agent answers with agent is older than this client — update it from
the Nodes tab or with swarmexec init --force. A
policy can refuse them separately
(actions inspect and kill). In the search bar, Enter keeps the filter
and returns to the list; Esc clears the filter and closes the bar.
Auto-refresh
The tree auto-refreshes every ~10s, so a container replaced or a service scaled in the background shows up on its own — the cursor and any expanded services are preserved. r still forces an immediate refresh.