-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlocal_docker_clean.sh
executable file
·53 lines (41 loc) · 1.38 KB
/
local_docker_clean.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
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
is_docker_installed() {
if command -v docker >/dev/null 2>&1; then
return 0 # Docker is installed
else
return 1 # Docker is not installed
fi
}
if is_docker_installed; then
echo "Docker is installed. Let's wipe out all stuff ! "
echo "\n #Stop all running containers..."
docker stop $(docker ps -a -q)
echo "\n #Remove all stopped containers..."
docker rm $(docker ps -a -q)
echo "\n #Remove all images..."
docker rmi $(docker images -q)
echo "\n #Remove any volumes..."
docker volume rm $(docker volume ls -q)
echo "\n #Remove any networks..."
docker network prune -f
docker network rm $(docker network ls -q)
echo "\n #Prune the system (this will remove all unused data..."
docker system prune -f -a --volumes
echo "\n Docker is cleaned."
else
echo "Docker is not installed. What are you waiting to use docker ;-)"
fi
folder_airflow_plugins="./plugins"
folder_airflow_dags="./dags"
if [ -d "$folder_airflow_plugins" ]; then
rm -rf "$folder_airflow_plugins"
echo "Folder $folder_airflow_plugins has been removed."
else
echo "Folder $folder_airflow_plugins does not exist."
fi
if [ -d "$folder_airflow_dags" ]; then
rm -rf "$folder_airflow_dags"
echo "Folder $folder_airflow_dags has been removed."
else
echo "Folder $folder_airflow_dags does not exist."
fi