-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclear-docker.sh
executable file
·43 lines (35 loc) · 1016 Bytes
/
clear-docker.sh
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
35
36
37
38
39
40
41
42
43
# The script will
# - first stop all running containers (if any),
# - remove containers
# - remove images
# - remove volumes
# Stop all running containers
echo 'Stopping running containers (if available)...'
# shellcheck disable=SC2046
docker stop $(docker ps -a -q)
# Remove all stopped containers
echo 'Removing containers ..'
# shellcheck disable=SC2046
docker rm $(docker ps -a -q)
# Remove all images
echo 'Removing images ...'
# shellcheck disable=SC2046
docker rmi $(docker images -a -q)
# Remove all stray volumes if any
echo 'Removing docker container volumes (if any)'
# shellcheck disable=SC2046
docker volume rm $(docker volume ls -q)
# Remove all other unused entities
echo -n "Do you want to prune unused entities? (y/n) "
read -r answer
if [ "$answer" = "y" ]; then
echo "Pruning unused entities..."
docker system prune -a
fi
echo -n "Do you want to remove the volume folder of Milvus? (y/n) "
read -r answer
if [ "$answer" = "y" ]; then
cd milvus || exit
rm -rf volumes
cd ..
fi