dotfiles/scripts/housekeeping_docker.sh
Michael Grote 947024fcf1 chmod +x
Signed-off-by: Michael Grote <michael.grote@posteo.de>
2024-01-25 10:14:22 +01:00

28 lines
755 B
Bash
Executable file

#!/bin/bash
# Function to ask for confirmation
ask_confirmation() {
read -rp "Are you sure you want to proceed? (y/n): " response
case "$response" in
[yY][eE][sS]|[yY])
return 0 ;; # Proceed
*)
return 1 ;; # Cancel
esac
}
if ask_confirmation; then
echo "Proceeding..."
echo "docker system prune"
docker system prune -a
echo "Entferne inaktive Container"
docker container prune
echo "Entferne ungenutzte Images"
docker image prune
echo "Entferne inaktive Volumes"
docker volume prune
echo "Entferne inaktive Netzwerke"
docker network prune | docker images -q | xargs docker rmi
else
echo "Cancelled."
fi