dotfiles/scripts/housekeeping_docker.sh

29 lines
755 B
Bash
Raw Normal View History

2024-01-25 09:53:09 +01:00
#!/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