HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerModerate

Are there any best practices and/or tools for cleaning old Docker images on a regular basis?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
oldbasisaredockeranyregulartoolspracticesforand

Problem

Is there an elegant way or a best practice when it comes to deleting old images from the Docker registry?

I see a lot of requests/issues here: https://github.com/docker/docker-registry/labels/delete, but didn't find a good/popular solution for it.

So, is there a tool or a technique which would help me do that?

Also, is there any best practices which you follow while doing it?

Solution

I've had good luck with
Spotify/docker-gc. It can be run from cron or as a docker container.


A simple Docker container and image garbage collection script.



  • Containers that exited more than an hour ago are removed.



  • Images that don't belong to any remaining container after that are removed.

Context

StackExchange DevOps Q#691, answer score: 10

Revisions (0)

No revisions yet.