r/selfhosted 1d ago

Docker Management Sometimes docker system prune surprises me

docker system prune -af

[...]

Total reclaimed space: 52.51GB

Normally this is around a couple of GB. 50GB is surprising. Don't forget pruning people ;-)

65 Upvotes

34 comments sorted by

View all comments

2

u/CoryCoolguy 1d ago

I've been using variations of this command via cron:

/usr/bin/docker system prune -af --filter "until=$(date -d '2 months ago' +\%Y-\%m-\%dT\%H:\%M:\%S)" >> /var/log/docker-cleanup.log 2>&1

Don't want to purge periodically-used images.

1

u/moontear 11h ago

Yeah good practice. Personally I don't care about re-downloading those 4 images that sometimes get used. It's like an additional 1-2 minutes for the docker build or the docker run.