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

Support pulling image specified by tag and digest. #5259

Open
alaendle opened this issue Jul 16, 2021 · 6 comments
Open

Support pulling image specified by tag and digest. #5259

alaendle opened this issue Jul 16, 2021 · 6 comments
Assignees
Labels
1.2 Release 1.2 bug Something isn't working customer-reported enhancement New feature or request iotedge

Comments

@alaendle
Copy link

At the moment pulling is only possible by tag or digest.

const string ImageRegexPattern = @"^(?<repo>([^/]*/)*)(?<image>[^/:]+)(?<tag>:[^/:]+)?$";

By looking at the regex it seems to be coincidence that a reference in the form of repo/image@sha256:abc...defis considered valid - because @sha256 is parsed as part of the image name and only the hash value is considered as a tag. Nonetheless it is working 😉

However the form of repo/image:tag@digest should also be recognized as a valid reference.

E.g. something like

mcr.microsoft.com/azureiotedge-metrics-collector:1.0.0@sha256:21a79c116574df6eff1da3b75c6237e807c96ddc8b7e94e76afa58dec078adf6

should be accepted.

Please note that this already works (maybe by accident) if the tag is removed:

mcr.microsoft.com/azureiotedge-metrics-collector@sha256:21a79c116574df6eff1da3b75c6237e807c96ddc8b7e94e76afa58dec078adf6

But for documentation and maintenance purposes the tag would be a very valuable information inside the reference.

Please let me know if I was unclear or if you need additional information.

@ancaantochi ancaantochi self-assigned this Jul 16, 2021
@ancaantochi ancaantochi added the bug Something isn't working label Jul 20, 2021
@ancaantochi
Copy link
Contributor

Thanks for reporting this, it looks like the regex is not handling repo/image:tag@digest

@github-actions
Copy link

This issue is being marked as stale because it has been open for 30 days with no activity.

@onalante-msft
Copy link
Contributor

onalante-msft commented Aug 31, 2021

This is definitely a bug as far as the parsing is concerned, since in the image-with-digest case the digest is considered part of the image capturing group. However, I believe Docker does not distinguish between digest-only and tag-and-digest for image creation; digest always seems to be taken as the image selector if present, regardless of whether the human-readable tag exists in the repository.

onalante-msft added a commit to onalante-msft/iotedge that referenced this issue Aug 31, 2021
@alaendle
Copy link
Author

alaendle commented Sep 2, 2021

@onalante-msft you are absolutly right with "Docker does not distinguish between digest-only and tag-and-digest for image creation; digest always seems to be taken as the image selector if present". However I still believe it is still valuable to be able to refer both in a deployment manifest - the ":tag@digest" notation has a value: it provides a way to know what that digest is for humans, just like a comment. So I really hope you would also allow this notation (the current PR seems to forbid this).

Please note that also tools other than the docker cli allow the ":tag@digest" notation (e.g. containers/podman#6721, containers/buildah#3331, cri-o/cri-o#2351) - maybe this convinces 😃

@onalante-msft
Copy link
Contributor

onalante-msft commented Sep 2, 2021

Oh, I was not aware that :tag@digest was standard practice. Thank you for pointing it out! I will update the pull request to allow for this.

onalante-msft added a commit to onalante-msft/iotedge that referenced this issue Sep 3, 2021
@onalante-msft onalante-msft added enhancement New feature or request and removed no-issue-activity labels Sep 5, 2021
@onalante-msft
Copy link
Contributor

An update: for now, I will have to pare back the pull request to only fix the bug wherein the digest is included in the image name. It will take some additional coordination to fully support this style of image references. For now, you should™ be able to specify image digests in settings.digest alongside the tag in settings.image.

Thank you for your patience!

onalante-msft added a commit to onalante-msft/iotedge that referenced this issue Sep 12, 2021
onalante-msft added a commit to onalante-msft/iotedge that referenced this issue Sep 14, 2021
@damonbarry damonbarry added the 1.2 Release 1.2 label Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.2 Release 1.2 bug Something isn't working customer-reported enhancement New feature or request iotedge
Projects
None yet
Development

No branches or pull requests

4 participants