-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
c8d: images/json return image manifests #45948
Conversation
The ImageManifest used to store the manifest of the parent index/manifest list, this means that users would see multiple same entries in the images list when a multi-platform image is pulled/built. Using the manifest instead makes is so that we now see different entires for each platform image. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
The containerd API doesn't give us anything for this so we need to take to slow path: list all images and then walk each manifest of these images until we find the manifest the user is asking. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
As we discussed in the maintainers call today, I think this is a step in the opposite direction of what we need. 😅 As I tried to describe over in #45735 (comment), having What we discussed on the call today was that the short-term fix should be that we update this endpoint to return a single entry for each name/value pair, and that for now, all the "image specific" metadata (labels, config, size) should be either "default platform" or "first platform we have locally" (which then matches the logic for commands like As for the data model, I think the ID of that "image" being the manifest list/index digest is the only thing that really makes sense (so the current implementation is "more correct" from that respect). In typing this, I realized we might be talking past each other a bit, so I implemented it as a PR (that probably has problems, but hopefully communicates more clearly): #45967 😇 |
My thinking behind this change is that it's better than what we have today (showing multiple times the same name/id for different platforms of an image). With this change the user at least can have the different IDs for each image they pulled/built so they can do something with them. It's not ideal of course, we are trying to put a square in a circle. I'm not sure #45967 changes are what we want, that change hides information from the users: if a user builds or pulls multiple platforms of an image they have no way of seeing them. Another reason why I think this is a step in the right direction: no matter what the final API will look like, parts of these changes will be needed: getting an image for a platform by its digest. About the same name, we kinda already have that: $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker-dev latest 95593035e9ad 7 minutes ago 1.52GB
<none> <none> 0465a961d0af 10 minutes ago 1.52GB
<none> <none> f9d8b43c1a4a 12 minutes ago 1.52GB
<none> <none> a81504762528 3 days ago 1.52GB
... Comparing this output with the output with my changes, in my mind these are closer to one another than the output we have right now with the same name/ID and as a bonus the user can really see all the present images. Note: I was implementing what @thaJeztah proposed in my first PR and thought I could extract these changes so that the "final" multi-platform PR is smaller. I thought it would be less controversial :D |
- What I did
Changed the way we return multi-platform images, we used to return the same name/id for each platform of an image. The ID used to be the ID of the index. With this change we now return the ID of each manifest. Also changed it so that we can inspect etc. an image by its manifest ID.
Before:
After:
- How I did it
Note: this is slow and gets slower as the number of the images increases, but for now it works, we will have to find a better way to find an image manifest by digest, either by adding metadata to the image we pull/build or by contributing a change to containerd. The ideal would be for containerd to have an API that does what we need.
- How to verify it
Pull multiple platforms of the same image and list them:
And then list them.
- Description for the changelog
containerd image store:
docker images
now show the ID of the image a specific platform instead of the ID of the manifest list- A picture of a cute animal (not mandatory but encouraged)