diff --git a/commands.go b/commands.go index c793b27c08..8cb51d4195 100644 --- a/commands.go +++ b/commands.go @@ -1231,10 +1231,11 @@ func PrintTreeNode(cli *DockerCli, noTrunc *bool, image APIImages, prefix string imageID = utils.TruncateID(image.ID) } + fmt.Fprintf(cli.out, "%s%s Size: %s (virtual %s)", prefix, imageID, utils.HumanSize(image.Size), utils.HumanSize(image.VirtualSize)) if image.RepoTags[0] != ":" { - fmt.Fprintf(cli.out, "%s%s Tags: %s\n", prefix, imageID, strings.Join(image.RepoTags, ",")) + fmt.Fprintf(cli.out, " Tags: %s\n", strings.Join(image.RepoTags, ",")) } else { - fmt.Fprintf(cli.out, "%s%s\n", prefix, imageID) + fmt.Fprint(cli.out, "\n") } } diff --git a/commands_test.go b/commands_test.go index bed9557bb1..479e295dd8 100644 --- a/commands_test.go +++ b/commands_test.go @@ -778,11 +778,11 @@ func TestImagesTree(t *testing.T) { cmdOutput := string(cmdOutputBytes) regexpStrings := []string{ - fmt.Sprintf("└─%s Tags: %s:latest", unitTestImageIDShort, unitTestImageName), + fmt.Sprintf("└─%s Size: (\\d+.\\d+ MB) \\(virtual \\d+.\\d+ MB\\) Tags: %s:latest", unitTestImageIDShort, unitTestImageName), "(?m)^ └─[0-9a-f]+", "(?m)^ └─[0-9a-f]+", "(?m)^ └─[0-9a-f]+", - fmt.Sprintf(" └─%s Tags: test:latest", utils.TruncateID(image.ID)), + fmt.Sprintf(" └─%s Size: \\d+.\\d+ kB \\(virtual \\d+.\\d+ MB\\) Tags: test:latest", utils.TruncateID(image.ID)), } compiledRegexps := []*regexp.Regexp{}