From ce209504224356839fc42e62171f45b405f9a35b Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Wed, 11 Jan 2017 13:42:49 -0800 Subject: [PATCH] Fix ImageSummary.Size value The prune PR changed the meaning of the file to mean "space on disk only unique to this image", this PR revert this change. Signed-off-by: Kenfe-Mickael Laventure --- command/formatter/image.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/command/formatter/image.go b/command/formatter/image.go index 594b2f3926..5c7de826f0 100644 --- a/command/formatter/image.go +++ b/command/formatter/image.go @@ -226,8 +226,7 @@ func (c *imageContext) CreatedAt() string { func (c *imageContext) Size() string { c.AddHeader(sizeHeader) - //NOTE: For backward compatibility we need to return VirtualSize - return units.HumanSizeWithPrecision(float64(c.i.VirtualSize), 3) + return units.HumanSizeWithPrecision(float64(c.i.Size), 3) } func (c *imageContext) Containers() string { @@ -253,8 +252,8 @@ func (c *imageContext) SharedSize() string { func (c *imageContext) UniqueSize() string { c.AddHeader(uniqueSizeHeader) - if c.i.Size == -1 { + if c.i.VirtualSize == -1 || c.i.SharedSize == -1 { return "N/A" } - return units.HumanSize(float64(c.i.Size)) + return units.HumanSize(float64(c.i.VirtualSize - c.i.SharedSize)) }