[20.10] Fallback to manifest list when no platform match#42045
Merged
thaJeztah merged 2 commits intoFeb 18, 2021
Conversation
In some cases, in fact many in the wild, an image may have the incorrect platform on the image config. This can lead to failures to run an image, particularly when a user specifies a `--platform`. Typically what we see in the wild is a manifest list with an an entry for, as an example, linux/arm64 pointing to an image config that has linux/amd64 on it. This change falls back to looking up the manifest list for an image to see if the manifest list shows the image as the correct one for that platform. In order to accomplish this we need to traverse the leases associated with an image. Each image, if pulled with Docker 20.10, will have the manifest list stored in the containerd content store with the resource assigned to a lease keyed on the image ID. So we look up the lease for the image, then look up the assocated resources to find the manifest list, then check the manifest list for a platform match, then ensure that manifest referes to our image config. This is only used as a fallback when a user specified they want a particular platform and the image config that we have does not match that platform. Signed-off-by: Brian Goff <[email protected]> (cherry picked from commit 4be5453) Signed-off-by: Brian Goff <[email protected]>
Wrap platforms.Only and fallback to our ignore mismatches due to empty CPU variants. This just cleans things up and makes the logic re-usable in other places. Signed-off-by: Brian Goff <[email protected]> (cherry picked from commit 50f39e7) Signed-off-by: Brian Goff <[email protected]>
thaJeztah
enabled auto-merge
February 18, 2021 20:37
tiborvass
approved these changes
Feb 18, 2021
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick #41955
relates to / addresses docker/for-linux#1170 (comment)
In some cases, in fact many in the wild, an image may have the incorrect
platform on the image config.
This can lead to failures to run an image, particularly when a user
specifies a --platform.
Typically what we see in the wild is a manifest list with an an entry
for, as an example, linux/arm64 pointing to an image config that has
linux/amd64 on it.
This change falls back to looking up the manifest list for an image to
see if the manifest list shows the image as the correct one for that
platform.
In order to accomplish this we need to traverse the leases associated
with an image. Each image, if pulled with Docker 20.10, will have the
manifest list stored in the containerd content store with the resource
assigned to a lease keyed on the image ID.
So we look up the lease for the image, then look up the assocated
resources to find the manifest list, then check the manifest list for a
platform match, then ensure that manifest referes to our image config.
This is only used as a fallback when a user specified they want a
particular platform and the image config that we have does not match
that platform.