For AI agents: a markdown representation of this page is available at https://container-registry.com/docs/2.15/user-manual/filtering-rules-syntax/index.md. The site index is at https://container-registry.com/llms.txt.

Filtering Rules Syntax

Several Container Registry features let you select repositories or tags by a pattern instead of listing every name. You write the pattern once, and it matches every name that fits. Proxy cache filters, replication filters, tag retention rules, tag immutability rules, and P2P preheat policies all use the patterns on this page.

A pattern is written in one of two ways:

  • A glob pattern uses the wildcards *, **, and ?. This is the default wherever a feature offers a choice.
  • A regular expression matches against the full name. Some features also accept this form.

Glob patterns

A glob pattern matches a name with wildcards.

Double star (**)

** matches any characters, including the / path separator.

  • ** on its own matches every name.
  • library/** matches every repository under library/.

For example, in the tag retention rule dialog, ** selects all repositories:

Retention example doublestar

Single star (*)

* matches any characters up to the next /. It stops at a separator.

  • release* matches every name that starts with release.
  • *release matches every name that ends with release.
  • *release* matches every name with release anywhere in it.

To cross a /, use **, or put a star in each segment. release*/test*/** matches release_2021/test_new/1.0.

Question mark (?)

? matches exactly one character. test? matches test1 and test2, but not test12.

Match several patterns with braces

To match more than one pattern at once, list them in braces and separate them with commas: {library/**,bitnami/**}. You can use *, **, and ? inside the list.

A comma only separates patterns inside braces. Outside braces, a comma is a literal character, treated as part of the name. So a bare list such as library/**,bitnami/** is read as one pattern and matches nothing. Use the brace form instead.

For the full glob definition, see the doublestar pattern reference.

Regular expressions

A regular expression matches against the full name, from start to end, so anchor it accordingly.

  • ^library/.* matches every repository whose path starts with library/.

Use a regular expression when a glob pattern cannot express the match you need.