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.
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.
As an Alpha we provide Docker Distribution Pruner that solves above proposal, but it is not yet production ready.
Ensure that this is BETA production ready to be tested by a general audience:
- full testability, including integration tests,
- comprehensive documentation that describes the way of work,
- fix currently outstanding bugs,
- proper release cycle with contributing guide,
- release easy to use binaries
- make it GA,
- integrate that into Omnibus to be available for easy use by customers: users can enable their own cronjob,
- automatically enable cronjob that will periodically wipe out registry: far future.