Repository navigation
cli/command/formatter: restore fallback for container names with slashes - #7481
Merged
Merged
Conversation
Since commit f7a909d, ContainerContext.Names returns an empty string when truncating and every name of the container contains a slash. Before that change, all names were printed in that case. Classic Swarm prefixes container names with the node-name ("/<node-name>/<container-name>"), so `docker ps` against a classic Swarm API printed an empty NAMES column. Restore the fallback to printing all names when no name without slashes is found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Drew Erny <derny@mirantis.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
vvoland
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since v29.4.0,
docker psprints an emptyNAMEScolumn, and{{.Names}}is empty, when every name of a container contains a slash after the leading
/is stripped.That is the case with a classic Swarm API. Classic Swarm prefixes container
names with the node name, so they come back as
/<node-name>/<container-name>.Although classic Swarm is archived upstream, we still maintain a fork of it.
#6875 optimized
ContainerContext.Names. When truncating, it returns the firstname without a slash and skips legacy
--linkaliases. But when no such nameexists, it now returns an empty string. Before #6875, all names were printed in
that case, the same as with
--no-trunc.This patch restores that fallback. The common case, where the first name has no
slash, is unchanged: it still returns on the first iteration without allocating.
Added test cases for:
/node-1/foobar_baz→node-1/foobar_baz).This one fails without this patch.
Release notes (optional)
🤖 Generated with Claude Code