forked from gdiepen/docker-convenience-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_kill_all.sh
More file actions
executable file
·34 lines (29 loc) · 917 Bytes
/
docker_kill_all.sh
File metadata and controls
executable file
·34 lines (29 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
while true; do
read -r -p "Are you sure you want to delete ALL Docker data? You will not be able to recover any data! [y/N]" input
case $input in
[yY][eE][sS]|[yY]*)
echo "Stoping Docker Container and removing Volumes:"
docker stop $(docker container ls -a -q)
echo
echo "Removing all Containers"
docker rm $(docker container ls -a -q)
echo
echo "Force remove all volumes"
docker volume prune -f
echo
echo "Force remove all networks"
docker network prune -f
echo
echo "Removing all Images:"
docker rmi $(docker images -a -q)
echo
break;;
[nN][oO]|[nN]*)
echo "Exiting Script"
exit;;
*)
echo "Exiting Script"
exit;;
esac
done