diff --git a/cli/command/image/tree.go b/cli/command/image/tree.go index 2a497e6e77..ea8dc1a6cd 100644 --- a/cli/command/image/tree.go +++ b/cli/command/image/tree.go @@ -547,7 +547,11 @@ func (h imgColumn) PrintR(clr aec.ANSI, s string) string { func widestFirstColumnValue(headers []imgColumn, images []topImage) int { width := len(headers[0].Title) for _, img := range images { - for _, name := range img.Names { + names := img.Names + if len(names) == 0 { + names = []string{untaggedName} + } + for _, name := range names { if len(name) > width { width = len(name) }