其他的答案很好,特别是:
docker system prune # doesn't clean out old images
docker system prune --all # cleans out too much
但我需要在这两个命令中间做点什么
filter
docker image prune --all --filter "until=4320h" # delete images older than 6 months ago; 4320h = 24 hour/day * 30 days/month * 6 months
希望有帮助:)
供参考:
https://docs.docker.com/config/pruning/#prune-images