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
Proposal: Labels for non-container resources #20356
Comments
Note that a feature request for adding labels to volumes already exists in #17936 |
ah thx @thaJeztah |
That's something we'd like for Engine 1.11 (cc @tiborvass). |
I like the idea of having labels across several objects but we need to be careful to restrict the complexity. Specifically, there are number of problems with updates when labels become transitive. For example, if one starts a container from an image, should the container pick up the image labels? Following, should an image snapshot from a container pick up the container labels? In both cases, we may get incorrect or invalid information. |
To top that off we don't even currently store volume state locally... and also how does this affect objects which the engine doesn't specifically own (like multi-host networks, multi-host volumes). |
@stevvooe I mentioned some thoughts on that here; #18958 (comment) |
@thaJeztah I was more talking about the relationship with container and image labels, rather than updating them. I'm a little confused as to how that relates. Complicated schemes here won't help anyone. Images should not "inherit" container labels and vice versa. Without a full analysis of how transitivity will work and update cycle protection, it will be a sloppy mess of bugs. |
Compose would benefit from all of these labels, so +1 |
Setting labels for images during build time without workarounds which include changing Dockerfiles would really be nice. Also labels during build time are relevant for builds done using Compose as mentioned by @dnephin above me. |
EDIT: No need to read this if you don't care about updating labels, which is out of scope for this issue One requirement for this feature to be useful is to allow updating the labels. Before going into technical details, I would like to find a good UX. I could come up with these 3 solutions, none of which I really like, but I prefer the 3rd one among these:
If you can think of another solution that would have none of these UX issues, I would be glad to read about it. Otherwise, feel free to vote for one of those solutions. I'm voting 3. I deliberately didn't discuss what the Once we get agreement on the UX, we can discuss the implementation details. |
Forgot to say that, that UX proposal should cover the usecases mentioned here. |
FWIW I also like 3. I think trying to force it into the other commands wouldn't be ideal. The first class "label" concept also gives us more flexibility down the road. |
@tiborvass I'm confused. Why are these the options? What's wrong with the option from the OP :
Making labels mutable seems like it's an additional feature that can be added later. Having immutable labels is significantly more valuable. The (personally I don't think there are any strong use cases for #18958 and that having labels for all resources is a lot more important than being able to edit a label on an immutable resource.) |
Thanks @dnephin for making me realize I forgot an important point in my reasoning: your solution works well, IF you don't need to update labels. As soon as you need to update them, it doesn't work. Now a 3.b) solution could be: accept 3) but add some "sugar" to allow for creating labels the way you described it. Even on Does that make more sense? |
I'm still missing why "update" is required for this at all. Why can't we just add labels that are immutable, which will work for 95% of use cases, and worry about the 5% that need label updates later (or decide we don't need to update them). We've had immutable container labels for around a year, and they've been extremely valuable without any update command. Maybe it would help to separate the idea of post-build image labels and volume/network labels, since these act very differently. volume/network labels seem pretty straightfoward. post-build image labels are going to require changes to the distribution metadata, won't they? Unless we're talking about post-build labels that don't transfer with the image on push, which doesn't seem very useful. |
@dnephin totally valid point. How about we keep update out of scope for this one and just add the create labels? Does that sound reasonable? |
Yes, create only would be fine. |
Only supporting create for now is a valid approach as long as we know what the update will look like when we do support it and it won't case us to revisit the create step because we know people will want. I think @dnephin's approach for create ( |
@dnephin yeah sorry, I had some offline conversations with @ehazlett and it was my (mis)understanding that update was a requirement for this. It makes perfect sense to me to just do I do wonder about |
@duglin except that But again, we can discuss that for another issue. |
@tiborvass yup saw that but I still think its the right way to go - and yea we can discuss more later. But, in case you didn't see it: #13509 - an oldie. |
I think adding the
I still like that one, and would definitely be +1 (but probably a separate discussion), same for |
I would like to propose having labels for non-container resources. To start with, these would include:
For networks and volumes the same syntax as containers could be used. For example:
docker volume create -d local --label env=staging --label backup=1 redis-data
docker network create -d overlay --label env=staging --label app=test-app-v0 backend
For images, it would be best to have something like #18958 to add labels. However, update support / image labels might be out of scope for this proposal.
The text was updated successfully, but these errors were encountered: