浏览代码

c8d: show the real image creation date when listing images

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Djordje Lukic 1 年之前
父节点
当前提交
8f756fe679
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      daemon/containerd/image_list.go

+ 7 - 2
daemon/containerd/image_list.go

@@ -29,6 +29,9 @@ import (
 
 // Subset of ocispec.Image that only contains Labels
 type configLabels struct {
+	// Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6.
+	Created *time.Time `json:"created,omitempty"`
+
 	Config struct {
 		Labels map[string]string `json:"Labels,omitempty"`
 	} `json:"config,omitempty"`
@@ -277,9 +280,8 @@ func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore con
 	}
 
 	summary := &imagetypes.Summary{
-		ParentID:    "",
+		ParentID:    rawImg.Labels[imageLabelClassicBuilderParent],
 		ID:          target.String(),
-		Created:     rawImg.CreatedAt.Unix(),
 		RepoDigests: repoDigests,
 		RepoTags:    repoTags,
 		Size:        totalSize,
@@ -291,6 +293,9 @@ func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore con
 		SharedSize: -1,
 		Containers: -1,
 	}
+	if cfg.Created != nil {
+		summary.Created = cfg.Created.Unix()
+	}
 
 	if opts.ContainerCount {
 		// Get container count