diff --git a/cli/command/formatter/image.go b/cli/command/formatter/image.go index d16f42b5ba..5c569bdda7 100644 --- a/cli/command/formatter/image.go +++ b/cli/command/formatter/image.go @@ -248,7 +248,7 @@ func (c *imageContext) CreatedAt() string { } func (c *imageContext) Size() string { - return units.HumanSizeWithPrecision(float64(c.i.Size), 3) + return units.HumanSize(float64(c.i.Size)) } func (c *imageContext) Containers() string { diff --git a/cli/command/formatter/image_test.go b/cli/command/formatter/image_test.go index fcdf727c52..a6477f87c0 100644 --- a/cli/command/formatter/image_test.go +++ b/cli/command/formatter/image_test.go @@ -40,6 +40,11 @@ func TestImageContext(t *testing.T) { expValue: "10B", call: ctx.Size, }, + { + imageCtx: imageContext{i: types.ImageSummary{Size: 999900000}, trunc: true}, + expValue: "999.9MB", + call: ctx.Size, + }, { imageCtx: imageContext{i: image.Summary{Created: unix}, trunc: true}, expValue: time.Unix(unix, 0).String(), call: ctx.CreatedAt,