The Wayback Machine - https://web.archive.org/web/20251014201203/https://github.com/moby/moby/pull/46719
Skip to content

Conversation

rumpl
Copy link
Member

@rumpl rumpl commented Oct 25, 2023

- What I did

Used the creation date of the imge from the config and not from the containerd metadata,

$ docker pull busybox
$ docker images      
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
-busybox      latest    3fbc63216742   20 seconds ago   6.61MB
+busybox      latest    3fbc63216742   3 months ago   6.61MB

Also set the ParentID to whatever we find in the image labels

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)


created := int64(0)
if cfg.Created != nil {
created = cfg.Created.Unix()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Micro-nit; as we already have a summary var in which we store the image-data, I guess we can avoid the created var if we put this block after it;

if cfg.Created != nil {
    summary.Created = cfg.Created.Unix()
}

Would there be a need to do && !cfg.Created.IsZero() as well? (not sure)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to set the Created in the IsZero case, that's actually what the GD case does

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huhu, want me to change this one too while I'm at it?

if image.Created != nil {
created = image.Created.Unix()
}
summary := &imagetypes.Summary{

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! We can; but that's fine for a separate PR, as that's not a new change, right?

My comment was mostly; if we want to; let's do so before merging, to reduce (ever so little) code churn 👍

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@thaJeztah thaJeztah added status/2-code-review area/images Image Distribution containerd-integration Issues and PRs related to containerd integration labels Oct 25, 2023
@thaJeztah thaJeztah added this to the 25.0.0 milestone Oct 25, 2023
@rumpl rumpl force-pushed the c8d-image-created-date branch from 37ef049 to 8f756fe Compare October 25, 2023 14:50
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rumpl rumpl merged commit 7d5445e into moby:master Oct 25, 2023
@rumpl rumpl deleted the c8d-image-created-date branch October 25, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/images Image Distribution containerd-integration Issues and PRs related to containerd integration status/2-code-review

Projects

Development

Successfully merging this pull request may close these issues.

3 participants