-
Notifications
You must be signed in to change notification settings - Fork 819
fix(image): pin the image a container runs to its digest #5125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -87,6 +87,11 @@ const ( | |||
| // Platform is the normalized platform string like "linux/ppc64le". | ||||
| Platform = Prefix + "platform" | ||||
|
|
||||
| // ImageDigest is the digest of the image target the container was created from. The image name | ||||
| // stored by containerd can be retagged to point at something else, so it is not enough to tell | ||||
| // which image a container actually uses. | ||||
| ImageDigest = Prefix + "image-digest" | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docker stores the image digest in:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, and it turns out the two are the same value. I have pushed that: Happy to split the inspect part into its own PR if you would rather keep this one to the in-use lookup.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The label should no longer be required?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is still required: the label is where the digest is stored, and The container record containerd keeps has no field for an image digest — // containerd client/container_opts.go
func WithImage(i Image) NewContainerOpts {
return func(ctx context.Context, client *Client, c *containers.Container) error {
c.Image = i.Name()
return nil
}
}So without the label The one way to drop the label would be to write a digested reference into Happy to move it somewhere better if there is one. |
||||
|
|
||||
| // Mounts is the mount points for the container. | ||||
| Mounts = Prefix + "mounts" | ||||
|
|
||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker seems just storing the digest here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both fields, on the same container:
The digest goes in
Image, which is what the line above this one now does;Config.Imagekeeps the reference, and that is the line this comment landed on. Let me know if you meant something else.Also worth recording: that digest is the target descriptor, not an ID derived separately.
(docker 29.5.2, containerd snapshotter.) So the
Image.Target().Digestthis PR records at creation is the same value Docker reports.