We know that docker image prune
has a --filter
argument that can be used to select (and remove) images older than a given number of hours (e.g.--filter "until=7*24h"
).
We also know that docker images
has a similar --filter
argument that supports a before
key (e.g. docker images --filter "before=ubuntu:22.04"
), but that can only filter images created before a given image or reference (not a date).
But pruning as described above would apply to all containers, which is rather too broad. What if we wanted to prune the "old" images more selectively, restricting the pruning to the images of just a single container (e.g. to spare older base containers, etc.)?