Garbage collecting for CI / CD pipeline

Hi everyone.

Currently we’re running a CI / CD pipeline which looks as follows:

Git-Repo -> Jenkins -> “docker build” -> “docker push” to local registry -> “docker run” integration tests -> API call to the Rancher server that deploys the image onto the platform

The build of an image is triggered by a webhook from the git repo. So we’re building like 10-20 images per day.

These images get pushed to a private / local registry (v2). Now as you can imagine, the disk space gets eaten up pretty quickly with this setup.

Now my question: What’s the best way possible currently to solve this problem? Including removing old images from the Rancher server as well as from the registry and from the Rancher hosts.

Thanks for any ideas in advance.



One way we’ve dealt with a the same sort of registry space problem (and we build dozens of images per day some of which are 4GB in size) is to have multiple registries and promote images from one to another. Everything goes into the first registry and can be used for testing. Images that pass the automated tests and meet certain other criteria are automatically pushed to a second registry. When space becomes an issue, we can just throw away the data from the first registry and restart it. The more valuable builds are preserved in the second registry.

The same concept can be extended to more registries (we currently have three and will soon have four registries).

Currently, there is no way to remove old images from Rancher hosts through Rancher, but we have a feature request for image management that would allow this.

Also, this issue might be helpful to you. In @cloudnautique’s comment, it has the guides to use.