When running Docker for a long time, there are a lot of images in system. How can I remove all unused Docker images at once safety to free up the storage?
In additio
The other answers are great, specifically:
docker system prune # doesn't clean out old images
docker system prune --all # cleans out too much
But I needed something in the middle of the two commands so the filter
option was what I needed:
docker image prune --all --filter "until=4320h" # delete images older than 6 months ago; 4320h = 24 hour/day * 30 days/month * 6 months
Hope that helps :)
For reference: https://docs.docker.com/config/pruning/#prune-images