-
Notifications
You must be signed in to change notification settings - Fork 52
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
[feat req/debate] adding support for image digests with the skopeo relay #86
Comments
That's an interesting feature that would nicely complement the current functionality.
Keeping the two separate would actually be required. Syncing via digest and syncing via tag list, tag filtering & image matching address two fundamentally different uses cases. Syncing via digest is adequate when we know exactly what to sync beforehand, and that set does not change (at least not frequently). Tag filtering and image mapping however are indispensable when we do not know in advance what we need to sync, for example when we want to continuously sync various image streams produced by image build pipelines. For this we need to describe the set with rules, such as regular expressions or semver filters, and cannot use digests. |
@xelalexv awesome, thank you for your comment. The behavior of my 0.4.4 dregsy behavior (current)If the tags field is completely empty in the If the tags field is NOT empty, several filters (regex, semver, etc...) are used to get only the tags matching the filters. New feature: add support for digest in dregsy (my fork)I propose 2 new fields in
[...]
mappings:
- from: library/busybox
to: skopeo/library/busybox
digests:
- sha256:5e8e0509e829bb8f990249135a36e81a3ecbe94294e7a185cc14616e5fad96bd
- sha256:76582bc9c59276ea11459bf5ff4f54fd5b7fd23ff622d80479156108fdd26470
- sha256:6ba3c395f0a2941114d8dcdf80bedcc7e654252f5870dd94daff9cc3188f3eb2
preserve-digests: true
tags: ['1.29.2', '1.29.3', 'latest']
platform: linux/arm/v6 4 cases for the
I also implemented various tests on the digest to detect and ignore wrong digests. Wrong digests are digests that do not exist or that are not correctly formated. This ensure that |
My thoughts about the implementation of this feature in PR #95: I think we do not need to add the extra mappings:
- from: library/busybox
to: base-skopeo/digest/busybox
tags:
- sha256:acaddd9ed544f7baf3373064064a51250b14cfe3ec604d65765a53da5958e5f5 This will reduce the change set quite a bit. It would be mostly confined to the relays (it should be possible to offer this for the Docker relay as well), and the tag set. In tag set, we need to consider whether a tag is/contains a digest during tag pruning, since digests should never be pruned. |
Thank you @xelalexv for reviewing this PR 😄 .
Let me know if you think this is too much out of the scope of your roadmap and/or coding style. Remove hardcoded token in configuration samples?Other question: is this possible to remove the token Indeed I kept this token in my own files
|
At first glance, they may appear very different. But when looking at them a bit closer, we may find that they are more strongly related than we thought. Let's look at their definitions for a start: From the Docker Registry HTTP API V2 spec:
From OCI Content Descriptors spec:
The purpose of digests is to uniquely address content. The digest itself however does not convey anything about what it identifies. For that, a digest needs to be put into context, because digests are used for many parts of container images - layers/blobs, configurations, manifests. As such, the term digest has a very broad meaning. In the context of retrieving, i.e. pulling images from a registry, the digest we may specify in the image reference is the digest of the image manifest. Now for tags, quoting from Open Container Initiative Distribution Specification:
The Docker Registry spec only includes an indirect definition via the manifest fields relevant for pulling an image:
Now, when we refer to an image, adding a digest or a tag to the image name serves the same purpose from a use case perspective - we specify what particular version of that image we want. The difference is that the digest uniquely addresses that version, while for the tag we rely on the registry to resolve it to the associated version. So, when we look at our But there are also reasons why we would want digests and tags to be maintained in the same collection:
Bottom line: I currently see handling digests in the
This is just an example, you can use any path you want in
And I'm still interested in keeping feature parity between Docker and Skopeo relays, where possible without too much effort. 😄
This is explained here.
You probably copied that from the sample config in the README. Whether your test cases need authentication info depends on whether they do actual sync work. If they do, it would of course have to be meaningful auth info. Seeing that yours are config tests that don't actually intend to do a sync, you would not need that. |
Thank you for this detailed answer 👍 🙂 . I just want to highlight that skopeo --version
skopeo version 1.11.1 commit: fb1ade6d9e9b501e35b09538c9533fac5dd604b6 Below is an example of a skopeo copy --preserve-digests docker://docker.io/busybox@sha256:1dffc7fa199a5156cba6ef34db5f8aaf95d6d8593b907cd392bd813da4a04754 docker-archive:/tmp/docker.io-busybox-1.35.0-glibc-digest-pull.tar:docker.io/busybox:1.35.0-glib Getting image source signatures
Copying blob 880dcab25a96 done
Copying config 12b6f68a82 done
Writing manifest to image destination
Storing signatures Below is a wrong formatted example of a skopeo copy --preserve-digests docker://docker.io/busybox:sha256:1dffc7fa199a5156cba6ef34db5f8aaf95d6d8593b907cd392bd813da4a04754 docker-archive:/tmp/docker.io-busybox-1.35.0-glibc-digest-pull-no-at.tar:docker.io/busybox:1.35.0-glibc FATA[0000] Invalid source name docker://docker.io/busybox:sha256:1dffc7fa199a5156cba6ef34db5f8aaf95d6d8593b907cd392bd813da4a04754: invalid reference format Below is a not supported example of a skopeo copy --preserve-digests docker://docker.io/busybox:1.35.0-glibc@sha256:1dffc7fa199a5156cba6ef34db5f8aaf95d6d8593b907cd392bd813da4a04754 docker-archive:/tmp/docker.io-busybox-1.35.0-glibc-tag-and-digest-pull.tar:docker.io/busybox:1.35.0-glibc
Below a correct example with colon and a tag. skopeo copy --preserve-digests docker://docker.io/busybox:1.35.0-glibc docker-archive:/tmp/docker.io-busybox-1.35.0-glibc-tag-pull.tar:docker.io/busybox:1.35.0-glibc
Below a wrong example with at and a tag. skopeo copy --preserve-digests docker://docker.io/[email protected] docker-archive:/tmp/docker.io-busybox-1.35.0-glibc-tag-pull.tar:docker.io/busybox:1.35.0-glibc
I understand your point about keeping feature parity between Docker and Skopeo relays, you are absolutely right. I am just saying that I personally can not work on this. I am not sure Tag Set Pruning can be used with digest. You might need to manually add tags back after you But I might miss something. Conclusion:For the moment, I can not put more resources into my PR. And it seems that you have a precise idea of how you would implement this feature. Maybe you can use this PR as a source of inspiration, a do your own take at the implementation of the "digest feature", matching your coding style. This way, you can also implement proper tests using your If you need explanation on some of my source code, I will be happy to answer. But I will not be able to modify the current PR and source code to match what we discussed here about tags and digest. |
Yes, that's correct, and can be handled accordingly in the Skopeo relay.
Pruning will stay away from digests. Actually, looking into this I realized that I need to adjust pruning slightly such that it stays away from any verbatim tags.
Your issue & PR put the topic on the table in the first place, and our discussion helped in shaping the feature. So, totally worth it. Thanks for all the input! I've created an initial implementation and will push the branch shortly. |
I pushed dregsy images for this to DockerHub, for Alpine based image use tags |
Hello @ALL, I am currently trying to figure out how to add support for image digests copy/sync in
dregsy
.I think this is even simpler to implement than the tags based mapping which supports using regular expression to search through tags. Indeed with image digests, there is no need for search with regular expression, since a digest is unique and uniquely identify one particular image.
Image digest are also more robust than tags in certain situation when there is the need to match a very precise version of an image. And image digest are also used for crypto signature of container images.
What do you think about that? I must say, the
dregsy
source code is not really well documented. But I think I am starting to understand it a bit. I have several ideas as well.Description of image digests
An image digest looks like this below: using
crane
skopeo
& digestsA
skopeo copy
command using digest rather than tags looks like this :Important note: Skopeo (1.10.0) DOES NOT support using tags and digest at the same time.
dregsy configuration with digests
Below is an example of what could be a
dregsy-config.yaml
file which uses digestsIt is probably better to differentiate and separate "Tags based mapping" and "Digests based mapping", since
skopeo
does not support both at the same time.However it might be possible to have a more compact version where both a tag list and a digest list are part of the same mapping object. The
skopeo copy
requests are different when they use tags or digest (see above the skopeo example with digest).Also with digest, you can ignore
platform:
, since the digest already uniquely identify a precise image.But it might be overkill to dedicate
task
to either tag only or digest only.The text was updated successfully, but these errors were encountered: