Skip to content

Container Registry namespace configuration

Each namespace can have a configuration that controls access behaviour and lifecycle rules. Configuration is optional — until it exists, namespaces behave as private.

Visibility

SettingBehaviour
privatePull requires authentication
publicAnonymous pull allowed for repositories in this namespace

Create namespace configuration to set visibility. Changing visibility does not move existing images — it only changes who may pull without credentials.

When to use public visibility

Public namespaces suit images you want to distribute without credentials — for example open-source tooling or base images shared across teams. Keep production application images in private namespaces and use authenticated pull everywhere possible.

Retention policies

Retention policies automatically delete old tags and artifacts to control storage growth. Configure one or more rules per namespace.

Rule fields

Rule fieldDescription
daysDelete tags older than N days (by tag creation time)
days_since_createdKeep artifacts pushed within the last N days
days_since_pulledKeep artifacts pulled within the last N days
countKeep only the N most recent matching tags
repository_patternsLimit rule to repositories (wildcards supported, e.g. api-*, */cache)
tag_patternsLimit rule to tags (wildcards supported, e.g. v*, *-dev)
delete_untagged_imagesAlso remove artifacts that no longer have any tag

At least one retention criterion (days, days_since_created, days_since_pulled, or count) is required per rule.

Example scenarios

ScenarioSuggested rule
Keep last 10 release tagscount: 10 with tag_patterns: ["v*"]
Prune dev builds after 7 daysdays: 7 with tag_patterns: ["*-dev"]
Remove unused cache imagesdays_since_pulled: 30 with repository_patterns: ["*/cache"]
Clean up untagged layersdelete_untagged_images: true on any rule

Scheduling

Retention policies run automatically on a schedule (approximately hourly). You can also trigger an immediate run via the API:

POST …/retention-policy/run

Use an immediate run after configuring a new policy to apply cleanup without waiting for the next scheduled cycle.

Permissions

Creating and updating namespace configuration requires permissions on the container_registry_namespace_configuration IAM resource. See Access control for policy details.

Related documentation