Added pre-clean state and messages

This commit is contained in:
bkraul 2025-01-29 06:24:58 -06:00
parent 3e69390b44
commit 88b4f49062

View File

@ -1,14 +1,21 @@
#!/bin/bash
# show current space.
echo "Current state:"
docker system df
echo
echo "Performing cleanup..."
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v 1>/dev/null
# remove unused images
docker image prune -a -f
docker image prune -a -f 1>/dev/null
# remove unused volumes:
docker volume prune -a -f
docker volume prune -a -f 1>/dev/null
# remove buildx cache
docker buildx prune -f
docker buildx prune -f 1>/dev/null
# show results
echo
echo "After cleanup:"
docker system df