| ... | ... |
@@ -7,13 +7,12 @@ type APIHistory struct {
|
| 7 | 7 |
} |
| 8 | 8 |
|
| 9 | 9 |
type APIImages struct {
|
| 10 |
- Repository string `json:",omitempty"` |
|
| 11 |
- Tag string `json:",omitempty"` |
|
| 12 |
- ID string `json:"Id"` |
|
| 13 |
- Created int64 |
|
| 14 |
- Size int64 |
|
| 15 |
- ParentSize int64 |
|
| 16 |
- |
|
| 10 |
+ Repository string `json:",omitempty"` |
|
| 11 |
+ Tag string `json:",omitempty"` |
|
| 12 |
+ ID string `json:"Id"` |
|
| 13 |
+ Created int64 |
|
| 14 |
+ Size int64 |
|
| 15 |
+ VirtualSize int64 |
|
| 17 | 16 |
} |
| 18 | 17 |
|
| 19 | 18 |
type APIInfo struct {
|
| ... | ... |
@@ -28,11 +27,11 @@ type APIInfo struct {
|
| 28 | 28 |
|
| 29 | 29 |
type APIContainers struct {
|
| 30 | 30 |
ID string `json:"Id"` |
| 31 |
- Image string |
|
| 32 |
- Command string |
|
| 33 |
- Created int64 |
|
| 34 |
- Status string |
|
| 35 |
- Ports string |
|
| 31 |
+ Image string |
|
| 32 |
+ Command string |
|
| 33 |
+ Created int64 |
|
| 34 |
+ Status string |
|
| 35 |
+ Ports string |
|
| 36 | 36 |
SizeRw int64 |
| 37 | 37 |
SizeRootFs int64 |
| 38 | 38 |
} |
| ... | ... |
@@ -812,8 +812,8 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
| 812 | 812 |
fmt.Fprintf(w, "%s\t", utils.TruncateID(out.ID)) |
| 813 | 813 |
} |
| 814 | 814 |
fmt.Fprintf(w, "%s ago\t", utils.HumanDuration(time.Now().Sub(time.Unix(out.Created, 0)))) |
| 815 |
- if out.ParentSize > 0 {
|
|
| 816 |
- fmt.Fprintf(w, "%s (virtual %s)\n", utils.HumanSize(out.Size), utils.HumanSize(out.ParentSize)) |
|
| 815 |
+ if out.VirtualSize > 0 {
|
|
| 816 |
+ fmt.Fprintf(w, "%s (virtual %s)\n", utils.HumanSize(out.Size), utils.HumanSize(out.VirtualSize)) |
|
| 817 | 817 |
} else {
|
| 818 | 818 |
fmt.Fprintf(w, "%s\n", utils.HumanSize(out.Size)) |
| 819 | 819 |
} |
| ... | ... |
@@ -31,7 +31,6 @@ type Image struct {
|
| 31 | 31 |
Architecture string `json:"architecture,omitempty"` |
| 32 | 32 |
graph *Graph |
| 33 | 33 |
Size int64 |
| 34 |
- ParentSize int64 |
|
| 35 | 34 |
} |
| 36 | 35 |
|
| 37 | 36 |
func LoadImage(root string) (*Image, error) {
|
| ... | ... |
@@ -376,13 +375,13 @@ func (img *Image) Checksum() (string, error) {
|
| 376 | 376 |
return hash, nil |
| 377 | 377 |
} |
| 378 | 378 |
|
| 379 |
-func (img *Image) getVirtualSize(size int64) int64 {
|
|
| 379 |
+func (img *Image) getParentsSize(size int64) int64 {
|
|
| 380 | 380 |
parentImage, err := img.GetParent() |
| 381 | 381 |
if err != nil || parentImage == nil {
|
| 382 | 382 |
return size |
| 383 | 383 |
} |
| 384 | 384 |
size += parentImage.Size |
| 385 |
- return parentImage.getVirtualSize(size) |
|
| 385 |
+ return parentImage.getParentsSize(size) |
|
| 386 | 386 |
} |
| 387 | 387 |
|
| 388 | 388 |
// Build an Image object from raw json data |
| ... | ... |
@@ -177,7 +177,7 @@ func (srv *Server) Images(all bool, filter string) ([]APIImages, error) {
|
| 177 | 177 |
out.ID = image.ID |
| 178 | 178 |
out.Created = image.Created.Unix() |
| 179 | 179 |
out.Size = image.Size |
| 180 |
- out.ParentSize = image.getVirtualSize(0) |
|
| 180 |
+ out.VirtualSize = image.getParentsSize(0) + image.Size |
|
| 181 | 181 |
outs = append(outs, out) |
| 182 | 182 |
} |
| 183 | 183 |
} |
| ... | ... |
@@ -188,7 +188,7 @@ func (srv *Server) Images(all bool, filter string) ([]APIImages, error) {
|
| 188 | 188 |
out.ID = image.ID |
| 189 | 189 |
out.Created = image.Created.Unix() |
| 190 | 190 |
out.Size = image.Size |
| 191 |
- out.ParentSize = image.getVirtualSize(0) |
|
| 191 |
+ out.VirtualSize = image.getParentsSize(0) + image.Size |
|
| 192 | 192 |
outs = append(outs, out) |
| 193 | 193 |
} |
| 194 | 194 |
} |