Browse Source

Fix: incorrect time when last tag time is not set

Signed-off-by: Kian Eliasi <[email protected]>
Kian Eliasi 3 months ago
parent
commit
73e593e69a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      cmd/compose/images.go

+ 5 - 1
cmd/compose/images.go

@@ -101,6 +101,10 @@ func runImages(ctx context.Context, dockerCli command.Cli, backend api.Service,
 		// Convert map to slice
 		var imageList []img
 		for ctr, i := range images {
+			lastTagTime := i.LastTagTime
+			if lastTagTime.IsZero() {
+				lastTagTime = time.Now()
+			}
 			imageList = append(imageList, img{
 				ContainerName: ctr,
 				ID:            i.ID,
@@ -108,7 +112,7 @@ func runImages(ctx context.Context, dockerCli command.Cli, backend api.Service,
 				Tag:           i.Tag,
 				Platform:      platforms.Format(i.Platform),
 				Size:          i.Size,
-				LastTagTime:   i.LastTagTime,
+				LastTagTime:   lastTagTime,
 			})
 		}
 		json, err := formatter.ToJSON(imageList, "", "")