Editar

Compartir a través de


Wildcard support for artifact cache in Azure Container Registry

Wildcard use asterisks (*) to match multiple paths within the container image registry. This article lists the wildcards supported by the artifact cache feature for Azure Container Registry (ACR).

Note

Cache rules map from target repository => source repository.

Registry level wildcard

The registry level wildcard lets you cache all repositories from an upstream registry.

Cache rule Mapping Example
contoso.azurecr.io/* => mcr.microsoft.com/* Mapping for all images under ACR to MCR. contoso.azurecr.io/myapp/image1 => mcr.microsoft.com/myapp/image1<br>contoso.azurecr.io/myapp/image2 => mcr.microsoft.com/myapp/image2

Repository level wildcard

The repository level wildcard lets you cache all repositories from an upstream registry mapping to the repository prefix.

Cache Rule Mapping Example
contoso.azurecr.io/dotnet/* => mcr.microsoft.com/dotnet/* Mapping specific repositories under ACR to corresponding repositories in MCR. contoso.azurecr.io/dotnet/sdk => mcr.microsoft.com/dotnet/sdk
contoso.azurecr.io/dotnet/runtime => mcr.microsoft.com/dotnet/runtime
contoso.azurecr.io/library/dotnet/* => mcr.microsoft.com/dotnet/*
contoso.azurecr.io/library/python/* => docker.io/library/python/*
Mapping specific repositories under ACR to repositories from different upstream registries. contoso.azurecr.io/library/dotnet/app1 => mcr.microsoft.com/dotnet/app1
contoso.azurecr.io/library/python/app3 => docker.io/library/python/app3

Limitations for wildcard-based cache rules

Wildcard cache rules use asterisks (*) to match multiple paths within the container image registry. These rules can't overlap with other wildcard cache rules. In other words, if you have a wildcard cache rule for a certain registry path, you can't add another wildcard rule that overlaps with it.

Here are some examples of overlapping rules:

Example 1:

Existing cache rule: contoso.azurecr.io/* => mcr.microsoft.com/*
New cache being added: contoso.azurecr.io/library/* => docker.io/library/*

The addition of the new cache rule is blocked because the target repository path contoso.azurecr.io/library/* overlaps with the existing wildcard rule contoso.azurecr.io/*.

Example 2:

Existing cache rule: contoso.azurecr.io/library/* => mcr.microsoft.com/library/*
New cache being added: contoso.azurecr.io/library/dotnet/* => docker.io/library/dotnet/*

The addition of the new cache rule is blocked because the target repository path contoso.azurecr.io/library/dotnet/* overlaps with the existing wildcard rule contoso.azurecr.io/library/*.

Limitations for static/fixed cache rules

Static or fixed cache rules are more specific and don't use wildcards. They can potentially overlap with wildcard-based cache rules. If a cache rule specifies a fixed repository path, then it allows overlapping with a wildcard-based cache rule.

Example 1:

Existing cache rule: contoso.azurecr.io/* => mcr.microsoft.com/*
New cache being added: contoso.azurecr.io/library/dotnet => docker.io/library/dotnet

The addition of the new cache rule is allowed because contoso.azurecr.io/library/dotnet is a static path and can overlap with the wildcard cache rule contoso.azurecr.io/*.

Next steps