Skip to content

Commit 73e593e

Browse files
kianelbondeloof
authored andcommitted
Fix: incorrect time when last tag time is not set
Signed-off-by: Kian Eliasi <[email protected]>
1 parent 51499f6 commit 73e593e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/compose/images.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,18 @@ func runImages(ctx context.Context, dockerCli command.Cli, backend api.Service,
101101
// Convert map to slice
102102
var imageList []img
103103
for ctr, i := range images {
104+
lastTagTime := i.LastTagTime
105+
if lastTagTime.IsZero() {
106+
lastTagTime = time.Now()
107+
}
104108
imageList = append(imageList, img{
105109
ContainerName: ctr,
106110
ID: i.ID,
107111
Repository: i.Repository,
108112
Tag: i.Tag,
109113
Platform: platforms.Format(i.Platform),
110114
Size: i.Size,
111-
LastTagTime: i.LastTagTime,
115+
LastTagTime: lastTagTime,
112116
})
113117
}
114118
json, err := formatter.ToJSON(imageList, "", "")

0 commit comments

Comments
 (0)