docker-gc icon indicating copy to clipboard operation
docker-gc copied to clipboard

Fixed image exclusion to work with full regular expressions

Open ownaginatious opened this issue 9 years ago • 2 comments

Right now the image exclusion file (/etc/docker-gc-exclude) only supports basic regular expressions like so:

ubuntu:.*
random_image:latest

Syntax involving regular expression symbols like ^ or $ doesn't work. For example:

^ubuntu:.*$
^ttg-.*/:16$

Although in most cases what's supported is "good enough", it's rather confusing to only partially support typical regex operations. The reason it isn't supported seems to be a limitation of how the matching was done (basically repo:tag imageid is passed through with either the first or second block of text matching the regex).

This PR fixes that so that repo:tag is matched on its own followed by imageid on its own, and the resulting list of matching image IDs are combined.

This is backwards compatible and simply extends the functionality.

ownaginatious avatar Sep 27 '16 02:09 ownaginatious

Thank-you @ownaginatious . This has solved my required images getting cleaned up.

krishnaghatti avatar Jul 31 '17 19:07 krishnaghatti

No problem :+1: Now if only the maintainers of the repo actually looked at anyone's PRs...

ownaginatious avatar Jul 31 '17 23:07 ownaginatious