29 lines
755 B
Bash
29 lines
755 B
Bash
|
#!/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
|