Image's digest from HEAD request - #1078
Conversation
|
@mtrmac PTAL |
|
Does this article help? https://developers.redhat.com/blog/2019/08/14/best-practices-for-running-buildah-in-a-container/ Podman inside of a container is a lot more complex. Remember if you are doing this with Docker, you need to disable the seccomp filters, or use /usr/share/containers/seccomp.json Using podman for running the locked down Buildah container is the preferred mechanism. |
|
Thanks for the PR. Removing Does this actually end up reducing the number of requests? Basically every operation that can be done while reading c/image (copy an image, “inspect” it, …) will end up reading the manifest as one of the first things, and Unless I guess you have an external caller in mind for the new |
Argh that's what I thought but yeah it helps removing the first manifest GET request when a new image interface is setted up. Maybe
Yeah that's my point I don't want the GET manifest endpoint to be called when I instantiate a new image.
I compare a manifest digest located in my own bolt db to the I understand that my implementation might be out of scope for this library so don't hesitate to tell me if this is the case. |
That’s not something the library currently can do, OTOH there’s a clear benefit to sharing the auth/token/… infrastructure with c/image/docker. I’m interested in enabling this, although not at any cost. Adding methods to an interface like Primarily it’s not obvious to me that this generalizes — basically this is an optimization for a single server on the internet providing two operations that are ~exactly as expensive but one is by policy rate-limited, whereas most other servers and most other At this point it seems more natural to me to say “this is a very Docker-specific”, so I’d prefer to provide this as a Docker-specific API integrating with the Docker auth/token infrastructure but not with OTOH that would require setting up a separate @vrothberg RFC |
You're absolutely right, it's a Docker-specific case. I've made changes to reflect that without breaking the API. Let me know if it looks good to you. |
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
|
@mtrmac Done, thanks for your review. |
mtrmac
left a comment
There was a problem hiding this comment.
Thanks! LGTM.
@vrothberg PTAL, I’d like a second pair of eyes on the API.
vrothberg
left a comment
There was a problem hiding this comment.
LGTM, nice work @crazy-max and @mtrmac
Context
Docker Hub is instituting pull rate-limits for anonymous and free users since Nov 2, 2020.
With this limit in place, every time a NewImageSource is created, it will make a GET request on the manifest endpoint which counts as a pull and will return this body response if limit is reached:
Solution
First I have removed the ensureManifestIsLoaded in NewImage/NewImageSource func to prevent the initial (not required?) manifest GET request.
I have also added a new interface to be able to retrieve the manifest digest through a HEAD request which does not count as a pull on Docker Hub. GetDigest is exposed to be able to use the digest from the HEAD request on Diun and compared with a manifest stored in my bbolt database:
Further enhancement
Maybe this mechanic could be used in your internal cache to avoid unnecessary call to the manifest GET endpoint?
Let me know if I've missed something and thanks again for this great lib!