Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Fixed image exclusion to work with full regular expressions #130

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ownaginatious
Copy link

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.

@krishnaghatti
Copy link

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

@ownaginatious
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants