docker / docker/docker-py

Filters: negated label expressions don't appear to be supported

Open
#1,940 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

The engine docs specify that you can negate label expressions:

  • label (label=<key>, label=<key>=<value>, label!=<key>, or label!=<key>=<value>) Prune networks with (or without, in case label!=... is used) the specified labels.

Frankly, the engine docs leave a lot to be desired, there's no example of a negated mapping, so I don't know what format the engine expects. docker.utils.utils.convert_filters() just formats the filters as a JSON map of filter name (e.g. label) to a list of label expressions. I tried running client.prune_networks(filters={'label': '!=foo=bar'}) and no networks were deleted, despite me having created two networks, one with foo=bar and the other with foo=baz.

Am I just going about this wrong, or are negative expressions not supported?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docker.utils.utils.convert_filters() and client.prune_networks(), then compare their filter format with the linked Docker Engine network-prune documentation. Reproduce the case using networks labeled foo=bar and foo=baz. Done means determining the expected negated-label format and whether docker-py supports it, with the behavior or documentation clarified accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.