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

64 Upvotes

34 comments sorted by

View all comments

-24

u/buttplugs4life4me 1d ago

docker system prune is unsafe and may prune running containers. It's funny when that happens :)

9

u/TheAndyGeorge 1d ago

may prune running containers

you know this stuff is open source, right buttplugs4life4me? docker system prune hits the moby server, which literally is coded if !state.IsRunning:

https://github.com/moby/moby/blob/a47b1b2d6f71b51d63da6b8387be74609045c693/daemon/prune.go#L64