20 lines
469 B
Bash
Executable File
20 lines
469 B
Bash
Executable File
#!/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 1>/dev/null
|
|
# remove unused images
|
|
docker image prune -a -f 1>/dev/null
|
|
# remove unused volumes:
|
|
docker volume prune -a -f 1>/dev/null
|
|
# remove buildx cache
|
|
docker buildx prune -f 1>/dev/null
|
|
# show results
|
|
echo
|
|
echo "After cleanup:"
|
|
docker system df
|