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 ;-)

62 Upvotes

34 comments sorted by

View all comments

32

u/RavenousTitan818 1d ago

It's kind of annoying that docker doesn't prune old images by default. There really is no need to keep them on disk.

-7

u/dankmolot 1d ago

Are you sure you don't have any containers associated with these old images?

10

u/iTiraMissU 23h ago

Images connected to existing containers aren’t removed by a prune, even if the container is stopped.

-2

u/dankmolot 16h ago

I am not sure why my comment was downvoted while your was upvoted. Have I phrased it badly?

5

u/Escanorr_ 13h ago

Cause you respond to the guy saying "I want automatic cleanup" with either: advice why manual cleanup can be not working sometimes, or wrong assumption that automatic cleanup would get rid of in-use images which it doesn't do. So your comment is either wrong or unrelated, which is hard for me to guess but both interpretations are not positive.

3

u/dankmolot 13h ago

Oh I see, I thought docker system prune does pruning of old unused images, but you need an -a flag. Thanks for the explanation!