Git Product home page Git Product logo

Comments (9)

runcom avatar runcom commented on July 20, 2024

not sure, that header is there for security and content verification - not to hack on it for caching, shouldn't you take care of the whole index/cache system instead of having the library doing this? (I'm not sure how you would do this, just thinking out loud)
@mtrmac wdyt

from image.

glestaris avatar glestaris commented on July 20, 2024

not sure, that header is there for security and content verification - not to hack on it for caching

docker/distribution seems to use in in their tag service [1] to get the descriptor.

shouldn't you take care of the whole index/cache system instead of having the library doing this?

That's an interesting question. In GrootFS we consume containers/image for the Docker registry interaction and implement the cache (storing the blobs in the filesystem) ourselves. We would be very happy to PR some of the caching behaviour (and thus share the maintenance cost) if you think it's worthy. But that would be more of a long term thing.

[1] https://github.com/docker/distribution/blob/master/registry/client/repository.go#L294

from image.

mtrmac avatar mtrmac commented on July 20, 2024

that header is there for security and content verification - not to hack on it for caching

It is really for caching and discovering random corruption during transfers; nothing prevents the registry from lying in this header, or from returning the expected header value but a non-matching manifest.

I am more concerned about https://github.com/docker/docker/blob/master/distribution/pull_v2.go#L341 :

// NOTE: not using TagService.Get, since it uses HEAD requests
// against the manifests endpoint, which are not supported by
// all registry versions.

though I suppose treating this as an optimization which might fail would work.

More importantly, have you actually measured, or do you have anything to suggest, that using HEAD to look up in the cache would be an improvement? My first-order intuition is that a roundtrip is a roundtrip is a roundtrip, at least with the manifest sizes between a few hundred and a few thousand bytes, so I would expect HEAD manifest to take about as much time as GET manifest; and HEAD+GET is definitely worse than just GET.

from image.

glestaris avatar glestaris commented on July 20, 2024

// NOTE: not using TagService.Get, since it uses HEAD requests
// against the manifests endpoint, which are not supported by
// all registry versions.

Interesting.

More importantly, have you actually measured, or do you have anything to suggest, that using HEAD to look up in the cache would be an improvement? My first-order intuition is that a roundtrip is a roundtrip is a roundtrip, at least with the manifest sizes between a few hundred and a few thousand bytes, so I would expect HEAD manifest to take about as much time as GET manifest; and HEAD+GET is definitely worse than just GET.

Correct, we do not expect a huge improvement there. We will probably try and investigate how much this would give us before making a PR...

from image.

runcom avatar runcom commented on July 20, 2024

It is really for caching and discovering random corruption during transfers; nothing prevents the registry from lying in this header, or from returning the expected header value but a non-matching manifest.

but it isn't documented as such https://github.com/docker/distribution/blob/master/docs/spec/api.md#digest-header - I'm not sure either though

from image.

mtrmac avatar mtrmac commented on July 20, 2024

It is really for caching and discovering random corruption during transfers; nothing prevents the registry from lying in this header, or from returning the expected header value but a non-matching manifest.

but it isn't documented as such https://github.com/docker/distribution/blob/master/docs/spec/api.md#digest-header - I'm not sure either though

That says

IMPORTANT: If a digest is used to fetch content, the client should use the same digest used to fetch the content to verify it. The header Docker-Content-Digest should not be trusted over the "local" digest.

from image.

mtrmac avatar mtrmac commented on July 20, 2024

Correct, we do not expect a huge improvement there. We will probably try and investigate how much this would give us before making a PR...

(Philosophically, I am not opposed to exposing this server-side operation if you need it; just because I don’t see the value for our uses doesn’t mean it is useless or shouldn’t be merged. Of course, if it is not something other users of containers/image are likely to use, adding tests for that functionality would help minimize the risk of unintentionally breaking the code.)

from image.

rhatdan avatar rhatdan commented on July 20, 2024

@glestaris @mtrmac @vrothberg What is the state of this issue. It is two years old, can we close it?

from image.

vrothberg avatar vrothberg commented on July 20, 2024

After (almost) three years, we can close it.

from image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.