I have a GitLab instance with a Container Registry, and I want to ensure that my cleanup policy and garbage collector are configured correctly. My goal is to remove only the tags that are marked for deletion by the cleanup policy and not touch any other tags.
Here’s my current setup:
Cleanup Policy Configuration:
gitlab_rails['container_registry_cleanup'] = {
'enabled' => true,
'schedule' => {
'cron' => "0 2 * * 0", # Runs every Sunday at 2:00 AM
'policy_name' => 'default',
'keep_n' => 0, # Marks all matching tags for deletion
'older_than' => '30d', # Marks tags older than 30 days
'name_regex_delete' => '.*', # Applies to all tags
'name_regex_keep' => nil, # No exceptions
'keep_regex_delete' => true # Marks matching tags for deletion
}
}
Garbage Collector Configuration
gitlab_rails['container_registry_gc'] = {
'enabled' => true,
'schedule' => {
'cron' => "0 3 * * 0", # Runs every Sunday at 3:00 AM
'run_once' => true, # Runs only once per schedule
'delete_untagged' => false, # Does not delete untagged images
'delete_marked' => true # Deletes only tags marked for deletion
}
}
Will this configuration ensure that only tags marked for deletion by the cleanup policy are removed by the garbage collector?
Is there any risk that this setup might accidentally delete tags that are not marked for deletion?
Are there any best practices or improvements you would suggest for this configuration?
Thanks for your help!
New contributor
Michał Adamczyk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.