Skip to content

distribution, layer: extend external layer urls to other os - #27961

Closed
runcom wants to merge 2 commits into
moby:masterfrom
runcom:layer-federation
Closed

runcom wants to merge 2 commits into
moby:masterfrom
runcom:layer-federation

Conversation

@runcom

@runcom runcom commented Nov 1, 2016

Copy link
Copy Markdown
Member

Resurrecting #23014

Based on @dmp42's comment #23014 (comment)
Based on discussion at distribution/distribution#1825

This is the last piece needed to enable layers federations on non-Windows OSes.

/cc @stevvooe @vbatts @dmp42 @aaronlehmann

@dmp42

dmp42 commented Nov 1, 2016 •

Copy link
Copy Markdown
Contributor

Thanks @runcom

There have been several discussion threads on this, and many topics raised for discussion.

Trying to summarize here so we get a global view on this (happy to mark the items solved as we go, in this comment):

  • what happens if a new docker tries to push a manifest with a foreign layer to an older registry?
    • manifest blob unknown: blob unknown to registry
  • what is the UX if a new docker tries to push a manifest with a foreign layer to a new registry that forbids foreign layers?
    • manifest blob unknown: blob unknown to registry
  • what is the UX if a new docker tries to push a manifest with a foreign layer to a new registry that forbids that specific third-party origin?
    • manifest blob unknown: blob unknown to registry
    • can be enhanced by modifying registry message
  • what happens if an old docker tries to pull a manifest with a foreign layer?
    • retries, then fails with unknown blob
    • this is a problem IMHO - it does clearly break backward compatibility here
  • is DCT still working with this patch in all cases?
  • is authentication supported on the foreign layer pull?
    • it's not
  • if not, do we have a clear vision on how we may upgrade the protocol in the future to support that?
    • we don't
  • what protocols are supported by the foreign layer fetch? http? https? anything else?
    • http and https
  • depending on the answer to above questions, does pull by digest still work?
    • it does
  • when pushing a "private" manifest with a foreign layer, is there a registry mechanism to prevent the push, or provide feedback to the user that the data may be publicly available, regardless of the "privacy" status of the manifest, and that the registry can no longer control content visibility?
    • TBD
  • how do we push a manifest with foreign layers? is docker able to do that on its own, or do we need to use a standalone tool interacting with the registry API on its own
  • what happens if I pull a manifest with a foreign layer, then tag it and push it? is it going to push the foreign layer as well?
  • is there any effect on windows? is this safe/conflicting with the base layer mechanism?

@runcom

runcom commented Nov 2, 2016 •

Copy link
Copy Markdown
Member Author

what happens if a new docker tries to push a manifest with a foreign layer to an older registry?

tested against registry v2.3.0 which shouldn't have foreign layer support:

$ docker push myregistrydomain.com:5000/testruncom
The push refers to a repository [myregistrydomain.com:5000/testruncom]
be88d3b1e444: Layer already exists
e88b3f82283b: Skipped foreign layer
manifest blob unknown: blob unknown to registry

what is the UX if a new docker tries to push a manifest with a foreign layer to a new registry that forbids foreign layers?

Following is the output when validation is enabled (but I've also opened distribution/distribution#2035 to be stricter):

15:15:50 [github.com/docker/docker] ‹layer-federation*› docker push myregistrydomain.com:5000/testruncom
The push refers to a repository [myregistrydomain.com:5000/testruncom]
be88d3b1e444: Pushed
e88b3f82283b: Skipped foreign layer
manifest blob unknown: blob unknown to registry

what is the UX if a new docker tries to push a manifest with a foreign layer to a new registry that forbids that specific third-party origin?

This can be further enhanced I guess. since it's coming from https://github.com/docker/distribution/blob/master/registry/storage/schema2manifesthandler.go#L127:

$ docker push myregistrydomain.com:5000/testruncom
The push refers to a repository [myregistrydomain.com:5000/testruncom]
be88d3b1e444: Layer already exists
e88b3f82283b: Skipped foreign layer
manifest blob unknown: blob unknown to registry

what happens if an old docker tries to pull a manifest with a foreign layer?

It will simply retries to get the blob and eventually fail with unknown blob. Talking about this with @stevvooe over distribution/distribution#1825 turned out we don't need to fix this at the registry (distribution/distribution#1825 (comment)) even if I proposed to do so:

$ docker pull myregistrydomain.com:5000/testruncom
Using default tag: latest
latest: Pulling from testruncom
56bec22e3559: Downloading
e55b504c4cb5: Download complete
unknown blob

is DCT still working with this patch in all cases?

What's DCT?

is authentication supported on the foreign layer pull?
if not, do we have a clear vision on how we may upgrade the protocol in the future to support that?

We don't (at least to me) - and this is orthogonal to this feature now, since this support is already in for Windows images. Bikeshedding on this topic can be done in a separate issue since the feature is simple enough to extend it in the future.

what protocols are supported by the foreign layer fetch? http? https? anything else?

http and https

depending on the answer to above questions, does pull by digest still work?

it does to my testing

when pushing a "private" manifest with a foreign layer, is there a registry mechanism to prevent the push, or provide feedback to the user that the data may be publicly available, regardless of the "privacy" status of the manifest, and that the registry can no longer control content visibility?

There's no such thing at the moment. I can open a PR in docker/distribution to prevent altogether a push of a private manifest with a foreign layer or just provide a feeback to the user (how then... can we just document this at this point? see also about authentication above)

@runcom
runcom force-pushed the layer-federation branch 8 times, most recently from 385c207 to 3511095 Compare November 2, 2016 15:40
@dmp42

dmp42 commented Nov 2, 2016

Copy link
Copy Markdown
Contributor

Ok, updated my comment to track progress.

Couple of notes:

Indeed, let's try to make the messages a bit better where we can.

What's DCT?

Docker Content Trust https://docs.docker.com/engine/security/trust/content_trust/

[authentication] is orthogonal to this feature now, since this support is already in for Windows images.

We disagree on that - this was discussed at length already. There is a major difference between a platform requirement, and opening foreign layers to image producers.

Bikeshedding on this topic can be done in a separate issue since the feature is simple enough to extend it in the future.

I disagree as well. If we don't have a clear vision on how that could be done in the future, we will likely have to break compatibility yet again, which is something bad enough to not be dismissed.

[private images and foreign layers]. There's no such thing at the moment. I can open a PR in docker/distribution to prevent altogether a push of a private manifest with a foreign layer or just provide a feeback to the user (how then... can we just document this at this point? see also about authentication above)

The registry itself does not have knowledge about the "privacy" status of a manifest, it's a concept that belongs to the authn server.

I think the best we can do is to output a clear warning to the user pushing the manifest that this will effectively leak data regardless of the "privacy" status of the image on the registry.

Adding a couple more questions to solve (added them in my initial comment as well):

  • how do we push a manifest with foreign layers? is docker able to do that on its own, or do we need to use a standalone tool interacting with the registry API on its own
  • what happens if I pull a manifest with a foreign layer, then tag it and push it? is it going to push the foreign layer as well?
  • is there any effect on windows? is this safe/conflicting with the base layer mechanism?

Also, breaking backward compatibility is the main unresolved issue here (eg: this may warrant bumping the manifest schema version for these manifests).

@runcom

runcom commented Nov 2, 2016 •

Copy link
Copy Markdown
Member Author

is DCT still working with this patch in all cases?

seems so to my testing, digests won't change so DCT still works ok resolving names->digests correctly

how do we push a manifest with foreign layers? is docker able to do that on its own, or do we need to use a standalone tool interacting with the registry API on its own

docker can already do this with this patch (and windows can do this already)

what happens if I pull a manifest with a foreign layer, then tag it and push it? is it going to push the foreign layer as well?

No, the foreign layer is never pushed even after tagging another image

is there any effect on windows? is this safe/conflicting with the base layer mechanism?

I never heard of any issue on the windows side of this work which is already in place...

I think the best we can do is to output a clear warning to the user pushing the manifest that this will effectively leak data regardless of the "privacy" status of the image on the registry.

I'm fine adding a warning when pushing a private image with foreign layers (need to figure out how to do this in docker though)

@runcom

runcom commented Nov 2, 2016

Copy link
Copy Markdown
Member Author

@dmp42

what happens if an old docker tries to pull a manifest with a foreign layer?
retries, then fails with unknown blob
this is a problem IMHO - it does clearly break backward compatibility here

We disagree here, it's not breaking backward compatibility. That's forward compatibility (since we did add urls after 1.10.3 for instance). A new image built with foreign layers will of course not being able to be pulled by older clients, it's not breaking anything, it's a new feature which can't be used on older clients...

Also, breaking backward compatibility is the main unresolved issue here (eg: this may warrant bumping the manifest schema version for these manifests).

This is your call, I'd love to understand this soon though, not just saying we could bump (and again, as stated above I don't think this is breaking anything except new features not working with older clients...)

@dmp42

dmp42 commented Nov 2, 2016

Copy link
Copy Markdown
Contributor

We disagree here, it's not breaking backward compatibility

Using the same protocol version and APIs, it would now be possible to push an image that can't be pulled by older clients. This is a breaking change (see below).

I don't think this is breaking anything except new features not working with older clients...

We would be breaking the fundamental assumption that any image pushed by any engine version is pull-able by any other engine version.

We made radical changes and upgrade twice in 18 months:

  • when we moved from registry:1:python to registry:2:go (IIRC by docker 1.6) - and even in that case, we made sure that:
    • registry:1 protocol was still supported in the engine
    • we had server-side code to be able to transform registry:2 images into registry:1 images for older clients
  • when we rolled out the new schema version (https://docs.docker.com/registry/spec/manifest-v2-2/): we made sure that the registry would rewrite images to the previous schema version on the fly for older engines (the only casualty in that case being pull-by-digest of updated images by old clients, which prompted us to NOT publish updated version of official images for a long time, until that use case died out (from our logs)).

This is your call

I would rather have us talk about this and come to an agreement together.

I'd love to understand this soon though

Is the above ^ clarifying why this would be indeed a breaking change that might deserve at the very least a schema version bump and documentation discouraging its use for the time being, and ideally a server-side solution to proxy-cache / rewrite for older clients?

@runcom

runcom commented Nov 2, 2016

Copy link
Copy Markdown
Member Author

@dmp42 side note, could you update your comments with checklist above with my testing from #27961 (comment)

Is the above ^ clarifying why this would be indeed a breaking change that might deserve at the very least a schema version bump and documentation discouraging its use for the time being, and ideally a server-side solution to proxy-cache / rewrite for older clients?

Alright, I understand that. I understand a version bump may be required in this case. I don't think we can't actually proxy anything in this scenario though, as already noted elsewhere, the whole point of this feature was to not host layers on a registry. Caching them will break this assumption. Rewriting the manifest will very likely break pull-by-digest again (we can write out the urls maybe and compute the digest w/o urls to preserve the digest but it sounds like an ugly hack to me).

@runcom

runcom commented Nov 4, 2016

Copy link
Copy Markdown
Member Author

Ping @dmp42

I would also note that what you're asking here is impossible (as it was when upgrading schema1 to schema2).
If we upgrade to schema3 and the priority is not to break old clients, then by proxing the blobs and rewriting the manifests will break pull by digest, again. Do you see any non-breakable path here? I unfortunately don't.

I can only imagine a mechanism for old clients where the blob is just proxied from the registry and never kept there. How do you do this? Hopefully the Docker clients send a version header to the registry and we can programmatically chose when to proxy the blobs. Maybe.

Or, schema3, clients advertise what they support. But then pull by digest is broken again when rewriting manifests.

Do you have any other thoughts, opinion, concerns?

@aweiteka

Copy link
Copy Markdown

I don't see any other blocking concerns here. Can this be merged?

@runcom
runcom force-pushed the layer-federation branch 2 times, most recently from cbf48e5 to 860f32b Compare November 16, 2016 23:35
@dmp42

dmp42 commented Nov 20, 2016 •

Copy link
Copy Markdown
Contributor

@aweiteka

I don't see any other blocking concerns here.

I suggest you look again.

Can this be merged?

No.

@anusha-ragunathan

Copy link
Copy Markdown
Contributor

@runcom : Regarding the reported plugin issues:

  1. "you can pull images which are plugins (e.g. https://hub.docker.com/r/tiborvass/no-remove/) and the docker client will panic badly"
    We have fixed this in 1.12.4. There's no panic anymore. On using docker pull to pull plugins (instead of docker plugin install), the client will error out with a clear message stating that the "target is a plugin".

  2. "you can mix plugins and images"
    This will be fixed in Docker 1.13 GA and in the corresponding Docker public registry. Each repository will be pinned to the media type of the first content pushed to it. Any further content that's pushed to the repository that doesn’t match the mediatype will be rejected.

@runcom

runcom commented Dec 13, 2016

Copy link
Copy Markdown
Member Author

"you can pull images which are plugins (e.g. https://hub.docker.com/r/tiborvass/no-remove/) and the docker client will panic badly"
We have fixed this in 1.12.4. There's no panic anymore. On using docker pull to pull plugins (instead of docker plugin install), the client will error out with a clear message stating that the "target is a plugin".

clients < 1.12.x will be broken anyway I guess (I'll re-test)

@anusha-ragunathan

Copy link
Copy Markdown
Contributor

@runcom : Ofcourse. We don’t plan to fix all older clients, especially given that the panic is in the client and hence non-critical.

@runcom

runcom commented Dec 13, 2016

Copy link
Copy Markdown
Member Author

@runcom : Ofcourse. We don’t plan to fix all older clients, especially given that the panic is in the client and hence non-critical.

old users will be broken as is the case in this PR if tiborvass/no-remove was an image and then it become a plugin

Comment thread distribution/pull_v2.go

purl, _ := url.Parse(u)
var tlsc *tls.Config
tlsc, err = ld.service.TLSConfig(purl.Host)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to inject the entire service just to get access to the TLSConfig?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@runcom Bump.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Mm yeah, we need a way to get the tls config. I'll fix that when in code-review if it's not OK to have the service injected here (which I don't like either).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@runcom I'd prefer we avoid it, as it is hard to remove later.

@LK4D4

LK4D4 commented Jan 26, 2017

Copy link
Copy Markdown
Contributor

@runcom @dmp42 @stevvooe have no idea what's going on :/ Any decision on design so far?

@stevvooe

Copy link
Copy Markdown
Contributor

@LK4D4 I think we're okay here. I just had a question about injecting the service for the purpose of getting a tls config.

@stevvooe

Copy link
Copy Markdown
Contributor

@aaronlehmann @dmcgowan Are we okay with the design here?

@dmcgowan

Copy link
Copy Markdown
Member

design 👍

@LK4D4

LK4D4 commented Jan 30, 2017

Copy link
Copy Markdown
Contributor

@aaronlehmann feel free to move to code-review if design is ok for you.

@aaronlehmann

Copy link
Copy Markdown

@dmp42, I see you had a list of concerns. Do you think those have been adequately addressed?

@dmp42

dmp42 commented Feb 2, 2017

Copy link
Copy Markdown
Contributor

to me that the backward compatibility story is a no sense

I think this statement ^ is pretty clear about the status and intentions of this.

It is definitely a no from me.

@LK4D4

LK4D4 commented Feb 2, 2017

Copy link
Copy Markdown
Contributor

@dmp42 @stevvooe @dmcgowan can you guys decide together on this? I'm pretty sure that one no is enough, but there is always room for discuss.
Thanks!

@runcom

runcom commented Feb 11, 2017

Copy link
Copy Markdown
Member Author

to me that the backward compatibility story is a no sense
I think this statement ^ is pretty clear about the status and intentions of this.

@dmp42 You simply stated that this change requires an api bump in image manifests while other stuff already implemented didn't (plugins?) (#27961 (comment)). I'm arguing since you didn't bump for plugins, you shouldn't bump for this change also.

But still, even if I'm totally mistaken and this requires an API bump, are you keen to do that? this PR and the other old ones simply were a "No" or "let's change that before" and I did it (in docker/distribution). So, can we just sit together and decide what to do?
I'm ok doing any work this feature requires as long as you guys provide guidance OR please simply decide We don't want such feature for Linux. I just opened the conversation, and even if I'm arguing on stuff, I'd really love inputs on what to do to land this feature.

@vdemeester

Copy link
Copy Markdown
Member

@dmp42 I'm not sure to follow. The urls part (that's used for these foreign layers) is already in the manifest of 2.2 (https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md#image-manifest-field-descriptions). So unless I am mistaken, I don't see a reason to bump version of the image manifest (cc @tonistiigi @stevvooe @aaronlehmann on this one, because I'm not sure 👼).

I also do agrees with @runcom regarding plugins is kinda broken on 1.12.x already (and probably on older version as well ?)… Or at least, we error out if somebody tries to pull a plugin as an image (e.g. docker pull tiborvass/no-remove). As long as it does not panic on older daemon, it's the same problem as plugins.

@stevvooe @dmcgowan @aaronlehmann wdyt ?

@dmp42

dmp42 commented Feb 14, 2017

Copy link
Copy Markdown
Contributor

@dmp42 You simply stated that this change requires an api bump in image manifests

If we want this to succeed, we need to introduce it in a way that makes it possible for registry operators to roll it out without having to just blow existing users.

I don't think we can just tell them: "hey, enable it, it's fine, some of the images will just break cryptically (complaining about a missing layer after repeatedly trying to fetch it) for some of your users".

Maybe there is a better solution than an API bump to achieve decent user experience - am open to that.

while other stuff already implemented didn't (plugins?) (#27961 (comment)). I'm arguing since you didn't bump for plugins, you shouldn't bump for this change also.

It probably should have been bumped - and plugins should have been done differently IMHO (at least, not break like that).
Either way, I don't think pointing at previous shortcomings is a compelling argument to repeat mistakes.

But still, even if I'm totally mistaken and this requires an API bump, are you keen to do that?

I believe everybody here spent quite some time looking at this.

this PR and the other old ones simply were a "No" or "let's change that before" and I did it (in docker/distribution). So, can we just sit together and decide what to do?

Propose a solution that achieves decent user experience for older versions (as discussed in the previous comments)

I'm ok doing any work this feature requires as long as you guys provide guidance

See above.

OR please simply decide We don't want such feature for Linux.

We can have it, granted the original checklist is ok, and we find a solution for ^

I just opened the conversation, and even if I'm arguing on stuff, I'd really love inputs on what to do to land this feature.

Sure, it's fine to debate solutions - requirement being: decent experience for users (backward compat / graceful fallback) and something usable for operators.

Happy to discuss this more.

@stevvooe

Copy link
Copy Markdown
Contributor

To tell you the truth, this discussion is around forward compatibility, which I don't think we've ever intended to support. Making these backwards compatible would mean serving up the layers directly from the registry or from the URL. I also don't think a version bump will help here. We seem to think that is the solution to everything but we still have problems when bumping versions.

The main problem here is that the engines should say they have encountered an incompatible image type. We can backport a patch for this if it is a big deal, but I don't think there is any expectation that these images can work. In the least, we need to add messaging around cases where images cannot supported, as this problem will only grow with plugins, multiarch and the wonders of OCI. This is a growing problem that needs to be addressed anyways.

In general, software proprietors need to be selective in using this feature. If you push content that relies on URLs, then you need to be sure that all clients pulling that content can handle it, which simply isn't true for most linux deployments. The reason this worked for Windows was because there was no previous content. Thus, software proprietors looking to deploy on a wide number of docker versions won't be incentivized to use this feature.

The other thing to consider is that this functionality is under control of registry operators, as well. If a registry operator chooses not to accept URLs, or a specific set of URLs, then so be it, that is their policy.

Either way, I don't think we should be holding this up any longer. I agree with @runcom: plugins were pushed with one tenth of the scrutiny this is getting. Let's move forward with this and work out the problems. Obviously, I would hope that @runcom would volunteer to take on the extra maintenance burden.

@runcom

runcom commented Feb 17, 2017 •

Copy link
Copy Markdown
Member Author

@stevvooe

Making these backwards compatible would mean serving up the layers directly from the registry or from the URL

yeah, but that will totally defeat the whole purpose of having layers sitting outside registries I guess.

The main problem here is that the engines should say they have encountered an incompatible image type.

this may sound silly, but can't we just check the engine version if available and return a nice error when the given engine doesn't support foreign layers? happy to create a PR in docker/distribution

@runcom

runcom commented Feb 17, 2017

Copy link
Copy Markdown
Member Author

@dmp42

Sure, it's fine to debate solutions - requirement being: decent experience for users (backward compat / graceful fallback) and something usable for operators.

I think we agree there can't be any graceful fallback as again that will totally defeat the whole purpose of this feature...for backward compat we need to find a way to immediately error out if the client is old, agree.

@runcom

runcom commented Feb 20, 2017 •

Copy link
Copy Markdown
Member Author

@runcom : Regarding the reported plugin issues:

"you can pull images which are plugins (e.g. https://hub.docker.com/r/tiborvass/no-remove/) and the docker client will panic badly"
We have fixed this in 1.12.4. There's no panic anymore. On using docker pull to pull plugins (instead of docker plugin install), the client will error out with a clear message stating that the "target is a plugin".

"you can mix plugins and images"
This will be fixed in Docker 1.13 GA and in the corresponding Docker public registry. Each repository will be pinned to the media type of the first content pushed to it. Any further content that's pushed to the repository that doesn’t match the mediatype will be rejected.

@anusha-ragunathan for the record, none of those points are actually handling backward compatibility...with an older docker client, you still get a panic (e.g. v1.10.3), thus, if you switched an image reference from an image to a plugin, you broke those clients:

$ ./bundles/1.10.3/dynbinary/docker pull tiborvass/no-remove
Using default tag: latest
latest: Pulling from tiborvass/no-remove
961d35be79b4: Pull complete
unexpected EOF
$

# panic
2017/02/20 18:18:20 http: panic serving @: runtime error: invalid memory address or nil pointer dereference
goroutine 15 [running]:
net/http.(*conn).serve.func1(0xc42035a380)
        /usr/lib/golang/src/net/http/server.go:1491 +0x15c
panic(0x14d4dc0, 0xc4200100c0)
        /usr/lib/golang/src/runtime/panic.go:458 +0x271
github.com/docker/docker/distribution.(*v2Puller).pullSchema2(0xc4207e9860, 0x1eff8a0, 0xc4206df6c0, 0x7efcb11d5260, 0xc4206cfcc0, 0xc420d9e460, 0xc4209fd900, 0x47, 0xc4209fd9f0, 0x47, ...)
        /home/amurdaca/go/src/github.com/docker/docker/.gopath/src/github.com/docker/docker/distribution/pull_v2.go:473 +0xc4c
github.com/docker/docker/distribution.(*v2Puller).pullV2Tag(0xc4207e9860, 0x1eff8a0, 0xc4206decc0, 0x7efcb11d5260, 0xc4206cfcc0, 0xa, 0xc4206cfd50, 0x1)
        /home/amurdaca/go/src/github.com/docker/docker/.gopath/src/github.com/docker/docker/distribution/pull_v2.go:267 +0x820
[...]

Comment thread layer/ro_layer.go
func (rl *roLayer) Descriptor() distribution.Descriptor {
return rl.descriptor
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: put these after the type roLayer ....

@miminar

miminar commented Mar 23, 2017

Copy link
Copy Markdown
Contributor

I don't see this adding a new media type. Thus the manifests with URLs pointing to custom content servers can be crafted even now without clients being able to handle them. Docker Hub is safe since it whitelists urls already.

I don't suppose Docker will add the tooling to let users easily specify the URLs for the dependencies of the manifest to be created. And if yes, it won't encourage them to do so. So if the software proprietor uses some custom tooling to do it for some legal reasons, he is to be blamed by not intended audience if it fails to pull his images. If someone manages to pull it and re-distribute it, his image will inherit the bad reputation.

Docker doesn't guarantee that the content is run-able. In some cases, it does not even guarantee that it is serve-able. This PR just increases a motivation to do the latter (with private registries) without introducing the tools to do so. On the other hand, it gives more freedom to software vendors. And that goes hand in hand with responsibility.

Maybe such images can be marked with some special symbol in Docker Hub/Store saying that this content is partially served by third party vendor. This could help direct the consumers to blame the proprietor / image author, not the engine if something goes wrong. That's of course of out scope of this PR.

Regarding some of the open questions in the #27961 (comment) above, to my understanding:

Auth

is authentication supported on the foreign layer pull? - it's not
if not, do we have a clear vision on how we may upgrade the protocol in the future to support that? - we don't

I imagine the authentication happening on client side only. I don't see a need for registry to Stat the blobs on its own. I believe the Docker client should allow for updating the .config with credentials for blob urls (e.g. https://docker-blobs.vendor.tld). It could also parse a special directory for these entries (e.g. .docker/federated-sources.d/). If the credentials were not given before pulling some federated image, Docker would prompt for the credentials:

For all the federated blobs it is unauthorized to get, the docker client could:

  1. see if the current user has a .config entry partially matching the blob URL with credentials for the federated blob it doesn't have (if there are more, it would choose the one with the longest matching prefix)
  2. if yes and the HEAD succeeds, continue
  3. otherwise, put inaccessible blobs/urls in the queue
  4. repeat the above for each federated blob
  5. ask the user with the full URL for credentials to the blob
  6. if given (user is still not irritated enough to hit ^C), try it on the current blob
  7. if successful, remove the blob from the queue, store the credentials into the .config and process the queue of the inaccessible blobs again (to see if the credentials apply - if there's at least a partial url match)
  8. goto 5 until the queue is processed or until user hits ^C

If there's one or more blobs coming from the same endpoint with the credentials, I'm asked just once. If there are more federated blobs coming from different endpoints, each requiring authentication and I see three different prompts in a row, I give up and start thinking this software vendor went nuts. It's up to the software vendor to keep the access to the blobs simple if he strives for happy customers.

This doesn't aim to be a solid proposal. It's just an example trying to prove that adding UX to the future authentication is possible and may not be that much complicated. If you disagree, let's discuss it. I'm positive we can find a working solution.

Private images

when pushing a "private" manifest with a foreign layer, is there a registry mechanism to prevent the push, or provide feedback to the user that the data may be publicly available, regardless of the "privacy" status of the manifest, and that the registry can no longer control content visibility?

  • TBD

Maybe I'm missing something, but I don't see anything wrong about private image with federated layers. I base my application on a publicly accessible base layers of some sw proprietor. I cannot claim I own these layers and I don't claim them. I just want to keep my top-level application private. If I add a federated layer of my own on top, I surely am aware of that (since there's no official tooling) and I'm not interested in this kind of feedback.

I consider the last three questions already answered by @runcom.

The design LGTM.

@vdemeester

Copy link
Copy Markdown
Member

@runcom @stevvooe what is the status here ? 👼

@stevvooe

Copy link
Copy Markdown
Contributor

@vdemeester No objections to opening up foreign url support on pull, with or without the datatype. There may still be some UX issues to work out. cc @friism

@miminar These aren't really meant for applications that require authentication. This is only for applications that require that layers come from a specific source. If you want to propose an authentication subsystem, please do so in another issue: let's keep this focused on pure foreign layer support.

@cpuguy83

Copy link
Copy Markdown
Member

ping

@olljanat

Copy link
Copy Markdown
Contributor

@runcom this one needs to be rebased

@cpuguy83

cpuguy83 commented Mar 2, 2020

Copy link
Copy Markdown
Member

Closing since this went stale.
Also seems like this should be handled in containerd at this point.

@cpuguy83 cpuguy83 closed this Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.