Add docker ps ancestor filter for image#14570
Conversation
|
what about containers that have that image the distant history? e.g. the image in question was used to make another image and that's 2nd image is the one used to create the container. |
|
Ah 😝, this would make it way more complicated to implement then 😅, and I'm not sure how you would handle from a user point of view. Given that it was implement
And I have 3 images : base -> middle -> final
When I'm doing ``--filter=image=middle``
Then should it filter all containers based on middle and final, or just those with final ?I think the simpler the better (just filter with the image used when starting the container). And I don't really see a use case for distant history — I might be wrong though. |
20c5219 to
1c27013
Compare
|
I only see (potential) value is we walk the ancestry tree, the easy case I can pretty much grep :-( Not convinced. |
|
@icecrime On the other hand I'm not convinced on the
$ docker ps -a | grep busybox
5c33c99ac89f busybox […] toto
5ba009755259 maven […] busybox1
2aff61195a5a maven […] busybox
I do agree these are probably edge cases and might not happen a lot in real life or not that much but it felt so easy to implement. I also do see potential on the "walk the ancestry tree" but I'm not sure how it would look in a user point of view. Question like :
|
|
I only see the ancestry usecase as being interesting so no need for a flag to say "look at entire history", it should do it automagically. |
|
I can see use cases for taking ancestry when filtering, but I really wonder if this is what I would expect if I filter |
|
sorry |
|
the reason I'm not sure "image=foo" is that interesting is because there isn't much of a difference between: and I guess it might be a little useful to have: |
True, in many cases, either immediate parent or "uses" an image are what you're looking for. From a UX perspective though, I'm really against calling the "ancestor" filter "image", because it doesn't reflect the intent and will definitely lead to a lot of support questions / invalid bug reports. We can opt for not implementing immediate parent (for now) and only implement ancestor search once people start asking for it. Perhaps an easier name for the filter, would To the filtering itself, what kind of searches should be supported? A quick list;
|
|
I definitely +1 to more filters. |
d546941 to
39f9857
Compare
|
Collective review We would prefer the tree-traversal implementation instead of just filtering with a direct parent image name. Because in the inspect output, Image refers to the direct parent image, we should not call the filter As for answering #14570 (comment), we should support all of the input forms. They will have to be mapped to a full image ID anyways. Let's leave the "direct-parent-only" implementation for another time, as we seem to agree the tree-traversal is more useful. |
|
SGTM, thanks! |
There was a problem hiding this comment.
In the other test (below) you check for ancestors and immediate parent by ID, name, etc... but not digest. Here you're just checking for immediate parent by digest. I would hope checking for ancestor by digest would just work too, since its just another way to reference an image, but is it worth adding at least one check for "ancestor by digest" instead of just immediate parent?
There was a problem hiding this comment.
Ah right, building an image from the imageReference and make sure we get the digested one and its descendant.
|
looks good, just one question. |
ecf3244 to
05f35f8
Compare
|
Oh I though I pushed the docs (which are quite small) but didn't.. 😅. /cc @thaJeztah |
docs/reference/commandline/ps.md
Outdated
There was a problem hiding this comment.
we probably should avoid using "image id" here, because the filter also accepts "image name", right?
Will need some examples, to illustrate/describe the possible options
There was a problem hiding this comment.
@thaJeztah oh right, we should probably just add image (so it stays general) there and add more example in a Filtering chapter (as discussed a bit on IRC 😉)
05f35f8 to
0aa0f74
Compare
|
Updated with to take care of @duglin and @thaJeztah comments, I think 😅. |
|
docs LGTM, as discussed with @vdemeester, examples will be added in a filtering chapter/section #14570 (comment) |
|
@vdemeester LGTM |
|
Moving to docs review. |
|
LGTM per my previous comment #14570 (comment) |
0aa0f74 to
a49f36b
Compare
Makes it possible to filter containers by image, using --filter=ancestor=busybox and get all the container running busybox image and image based on busybox (to the bottom). Signed-off-by: Vincent Demeester <[email protected]>
a49f36b to
c1af0ac
Compare
|
ping @moxiegirl, looks like we merged the "follow up" before the one it's "following up" 😄 |
|
@thaJeztah yay 😅 😝 |
|
This is why I should leave the merging to others (@thaJeztah) ... |
|
@moxiegirl counting that as a LGTM, merging! |
Add docker ps ancestor filter for image
|
🎉 😉 |

Makes it possible to filter containers by image ancestor, using
--filter=ancestor=busyboxor--filter=ancestor=8c2e06607696. This is related to #13365, and for the image filter, it's actually ask sometimes on irc 🐸.The
ancestorfilter support the following notation:Still to do :
--filter=ancestorimage@digestSigned-off-by: Vincent Demeester [email protected]