c8d/list: Support dangling image filter#128
Conversation
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
| return nil, err | ||
| } | ||
|
|
||
| danglingFilter := opts.Filters.Contains("dangling") |
There was a problem hiding this comment.
Maybe we should implement this the same as in https://github.com/rumpl/moby/blob/master/daemon/images/image_list.go#L39-L46 ?
There was a problem hiding this comment.
The behavior is the same actually - dangling=false is not equivalent to empty dangling.
dangling=false <- list only non-dangling images
dangling=true <- list only dangling
dangling= <- list all images regardless if they're dangling or not
There was a problem hiding this comment.
Someone will ask you to make it the same eventually, might as well do it now
There was a problem hiding this comment.
But it's already the same 😄
It doesn't look the same, looking at the code you linked, because old ImageService code doesn't handle it in one place. First it evaluates the danglingOnly, so it looks like only dangling=true does anything meaningful, but then checks the dangling flag on every image separately: https://github.com/rumpl/moby/blob/master/daemon/images/image_list.go#L155
Or are you talking about something else?
| danglingValue = false | ||
| } else { | ||
| err := fmt.Errorf("invalid filter 'dangling=%s'", opts.Filters.Get("dangling")) | ||
| return nil, errdefs.InvalidParameter(err) |
There was a problem hiding this comment.
Should this really return errdefs? The graph driver one doesn't, it might be a good idea to extract the invalidFilter from the package and reuse?
There was a problem hiding this comment.
invalidFilter implements InvalidParameter so graph driver still indirectly returns an errdefs.InvalidParameter in this case.
As for invalidFilter - I'd like to get rid of it in this PR: moby#44003. This would allow to avoid manual creation of this error.
Implements
danglingfilter, which has been mentioned a lot in customer feedbacks.Signed-off-by: Paweł Gronowski pawel.gronowski@docker.com
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)