Skip to content
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

Use local image if input image is a manifest list #7798

Merged
merged 1 commit into from
Sep 30, 2020

Conversation

QiWang19
Copy link
Contributor

@QiWang19 QiWang19 commented Sep 28, 2020

If run&create image returns error: image contains manifest list, not a runnable image, find the local image that has digest matching the digest from the list and use the image from local storage for the command.

close #7233

Signed-off-by: Qi Wang [email protected]

@QiWang19 QiWang19 linked an issue Sep 28, 2020 that may be closed by this pull request
@rhatdan
Copy link
Member

rhatdan commented Sep 28, 2020

@containers/podman-maintainers PTAL

@QiWang19
Copy link
Contributor Author

@nalind PTAL

}
}
}
}
Copy link
Member

@nalind nalind Sep 28, 2020

Choose a reason for hiding this comment

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

This will match any local image which is also in the list, so it solves the problem when only one of them is present. If I've pulled more than one using the repository name and their respective digests, this will choose the first one in the list, when the one for the current architecture (if one is present) could be listed later in images. Instead of checking for any of the values returned by list.Instances(), can we use list.ChooseInstance() to select the one that would be correct for the current architecture, and only accept an image that matches the digest it returns?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@QiWang19
Copy link
Contributor Author

@nalind @containers/podman-maintainers PTAL

@nalind
Copy link
Member

nalind commented Sep 29, 2020

LGTM

@rhatdan
Copy link
Member

rhatdan commented Sep 29, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: QiWang19, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 29, 2020
@@ -33,7 +34,42 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat

_, mediaType, err := newImage.Manifest(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

Do you have to set this mediaType somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mediaType will be used to check if its a manifest.DockerV2Schema2MediaType
https://github.com/containers/podman/pull/7798/files#diff-5a91791543058d94a51dab8d8294ca7cR75

Copy link
Member

Choose a reason for hiding this comment

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

But if the newImage.Manifest(ctx) check fails, the nediaType is never set.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, good catch. If we do find a suitable image and update newImage to point to it, we need to make sure that mediaType is updated to the value that correctly describes its manifest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If newImage.Manifest(ctx) fails, use the mediaType of the local image.

If run&create image returns error: image contains manifest list, not a runnable image, find the local image that has digest matching the digest from the list and use the image from local storage for the command.

Signed-off-by: Qi Wang <[email protected]>
@rhatdan
Copy link
Member

rhatdan commented Sep 30, 2020

/lgtm
/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2020
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 30, 2020
@rhatdan
Copy link
Member

rhatdan commented Sep 30, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2020
@openshift-merge-robot openshift-merge-robot merged commit 1d7cb7f into containers:master Sep 30, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent treatment of manifest lists in "podman run"
5 participants