#8322·containerd

metadata: support setting `Image.CreatedAt` without using `context`

Author: AkihiroSudaCreated Mar 29, 2023Updated Sep 16, 2026
Labelskind/enhancementstatus/accepted

What is the problem you're trying to solve

https://github.com/containerd/containerd/blob/831b9a9ae87774b9b56c70a8408df540384d72af/metadata/images.go#L148-L157

Currently, Create(ctx, img) does not consume img.CreatedAt value by design.

This issue can be currently worked around by ctx = epoch.WithSourceDateEpoch(ctx, customCreatedAt), but this should be possible without depending on ctx too.

Describe the solution you'd like

Consume the value of img.CreatedAt when it is explicitly set.

This change requires changing the type of CreatedAt form time.Time to *time.Time, or, add another property like CreatedAtIsSet, so as to differentiate "not set" from "1970-01-01 00:00:00".

Additional context