-
Notifications
You must be signed in to change notification settings - Fork 384
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
Container filters can't be negated #673
Comments
I am curious and interested in which language feature (syntax sugar) I missed. I am unable to compile your provided example. Can you share the docs for the language feature that introduces the syntax you are using (initializing the dictionary)? My test runs fine: var containersListParameters = new ContainersListParameters();
containersListParameters.Filters = new Dictionary<string, IDictionary<string, bool>> { { "status", new Dictionary<string, bool> { { "exited", true } } } }; The filter only returns exited containers. |
Oh my example indeed doesn't compile 😅 I'll update it. |
AFAIK the bool flag does nothing. I have 4 container (3 exited, 1 running). I get the following results, which look Ok: Returns 4: var containersListParameters = new ContainersListParameters();
// containersListParameters.Filters = new Dictionary<string, IDictionary<string, bool>> { { "status", new Dictionary<string, bool> { { "exited", true } } } };
containersListParameters.All = true; Returns 1: var containersListParameters = new ContainersListParameters();
// containersListParameters.Filters = new Dictionary<string, IDictionary<string, bool>> { { "status", new Dictionary<string, bool> { { "exited", true } } } };
containersListParameters.All = false; Returns 3: var containersListParameters = new ContainersListParameters();
containersListParameters.Filters = new Dictionary<string, IDictionary<string, bool>> { { "status", new Dictionary<string, bool> { { "exited", true } } } };
// containersListParameters.All = false; |
But why was it added then? It's a bit confusing your 3rd example returns the same as this: var containersListParameters = new ContainersListParameters();
containersListParameters.Filters = new Dictionary<string, IDictionary<string, bool>> { { "status", new Dictionary<string, bool> { { "exited", false} } } }; |
I know, but I do not know why there is the additional
Maybe it was necessary in a previous API version? If you want to know the exact details, you probably need to look at QueryString and its history. I am using this library a lot and never noticed any differences whether |
Does any main developer of this project know what the var images1 = await client.Images.ListImagesAsync(
new ImagesListParameters()
{
Filters = new Dictionary<string, IDictionary<string, bool>>()
{
{"dangling", new Dictionary<string, bool>() {{"true", true}}}
}
});
// Success Changing the
The brackets |
Output of
dotnet --info
:Output
What version of Docker.DotNet?:
Steps to reproduce the issue:
false
:What actually happened?:
I got a list of all exited containers
What did you expect to happen?:
I get a list of all not exited containers
Additional information:
I use ASP.NET Core with dependency injection. The Docker client is registered as a singleton:
The text was updated successfully, but these errors were encountered: