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 <mickael.laventure@gmail.com>
| ... | ... |
@@ -226,8 +226,7 @@ func (c *imageContext) CreatedAt() string {
|
| 226 | 226 |
|
| 227 | 227 |
func (c *imageContext) Size() string {
|
| 228 | 228 |
c.AddHeader(sizeHeader) |
| 229 |
- //NOTE: For backward compatibility we need to return VirtualSize |
|
| 230 |
- return units.HumanSizeWithPrecision(float64(c.i.VirtualSize), 3) |
|
| 229 |
+ return units.HumanSizeWithPrecision(float64(c.i.Size), 3) |
|
| 231 | 230 |
} |
| 232 | 231 |
|
| 233 | 232 |
func (c *imageContext) Containers() string {
|
| ... | ... |
@@ -253,8 +252,8 @@ func (c *imageContext) SharedSize() string {
|
| 253 | 253 |
|
| 254 | 254 |
func (c *imageContext) UniqueSize() string {
|
| 255 | 255 |
c.AddHeader(uniqueSizeHeader) |
| 256 |
- if c.i.Size == -1 {
|
|
| 256 |
+ if c.i.VirtualSize == -1 || c.i.SharedSize == -1 {
|
|
| 257 | 257 |
return "N/A" |
| 258 | 258 |
} |
| 259 |
- return units.HumanSize(float64(c.i.Size)) |
|
| 259 |
+ return units.HumanSize(float64(c.i.VirtualSize - c.i.SharedSize)) |
|
| 260 | 260 |
} |
| ... | ... |
@@ -210,7 +210,6 @@ func (daemon *Daemon) Images(imageFilters filters.Args, all bool, withExtraAttrs |
| 210 | 210 |
rootFS := *img.RootFS |
| 211 | 211 |
rootFS.DiffIDs = nil |
| 212 | 212 |
|
| 213 |
- newImage.Size = 0 |
|
| 214 | 213 |
newImage.SharedSize = 0 |
| 215 | 214 |
for _, id := range img.RootFS.DiffIDs {
|
| 216 | 215 |
rootFS.Append(id) |
| ... | ... |
@@ -223,8 +222,6 @@ func (daemon *Daemon) Images(imageFilters filters.Args, all bool, withExtraAttrs |
| 223 | 223 |
|
| 224 | 224 |
if layerRefs[chid] > 1 {
|
| 225 | 225 |
newImage.SharedSize += diffSize |
| 226 |
- } else {
|
|
| 227 |
- newImage.Size += diffSize |
|
| 228 | 226 |
} |
| 229 | 227 |
} |
| 230 | 228 |
} |
| ... | ... |
@@ -323,7 +320,7 @@ func newImage(image *image.Image, virtualSize int64) *types.ImageSummary {
|
| 323 | 323 |
newImage.ParentID = image.Parent.String() |
| 324 | 324 |
newImage.ID = image.ID().String() |
| 325 | 325 |
newImage.Created = image.Created.Unix() |
| 326 |
- newImage.Size = -1 |
|
| 326 |
+ newImage.Size = virtualSize |
|
| 327 | 327 |
newImage.VirtualSize = virtualSize |
| 328 | 328 |
newImage.SharedSize = -1 |
| 329 | 329 |
newImage.Containers = -1 |