From dcc1b4baf6d0eb068010d071bc44daf72b12cd4a Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Mon, 23 Jan 2017 13:52:33 -0800 Subject: [PATCH] Ensure proper value is used when computing reclaimable space When Size was reverted to be equal to VirtualSize, the df command formatter was not correctly updated to account for the change. Signed-off-by: Kenfe-Mickael Laventure --- cli/command/formatter/disk_usage.go | 5 ++++- daemon/images.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/command/formatter/disk_usage.go b/cli/command/formatter/disk_usage.go index ff1ab768c0..dc5eec41d7 100644 --- a/cli/command/formatter/disk_usage.go +++ b/cli/command/formatter/disk_usage.go @@ -196,7 +196,10 @@ func (c *diskUsageImagesContext) Reclaimable() string { c.AddHeader(reclaimableHeader) for _, i := range c.images { if i.Containers != 0 { - used += i.Size + if i.VirtualSize == -1 || i.SharedSize == -1 { + continue + } + used += i.VirtualSize - i.SharedSize } } diff --git a/daemon/images.go b/daemon/images.go index 642802abce..a8571f6dc9 100644 --- a/daemon/images.go +++ b/daemon/images.go @@ -205,7 +205,7 @@ func (daemon *Daemon) Images(imageFilters filters.Args, all bool, withExtraAttrs } if withExtraAttrs { - // Get Shared and Unique sizes + // Get Shared sizes for img, newImage := range imagesMap { rootFS := *img.RootFS rootFS.DiffIDs = nil