Skip to content

Clean up old container image revisions

Problem to Solve

Currently, there is no way to clean up old revisions of a container image in a registry. As a result, the registry can grow very large, especially when building containers as part of CI. In many cases users only care about the latest revision. There is an API endpoint in the registry to clean up older revisions but there are a few problems.

Proposal

To solve this problem for users we will introduce a separate tool that can be run administratively to remove unused images, or obsolete images based on administrator preference.

Currently, we provide a Docker Distribution GC (https://docs.gitlab.com/omnibus/maintenance/#container-registry-garbage-collection), but it can only remove layers that are no longer referenced. The use case of today's registry is that people push a lot of revisions to the same tag. Due to an architecture of Docker Distribution, it preserves all revisions in the system, thus consumes a lot of space. This tool should allows users to wipe-out these historical revisions from the GitLab Container Registry.

Solution

Edited by Jason Yavorsky