forked from nmarw25/GROW-Cryptography-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup.sh
executable file
·33 lines (23 loc) · 1.11 KB
/
cleanup.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
#!/bin/bash
# Exit the script if any command fails
set -e
# Define the project name (same as in the `name` field in your docker-compose.yml)
PROJECT_NAME="queryshield"
APP_IMAGE="queryshield-app"
echo "Stopping and removing containers, networks, and volumes for project: $PROJECT_NAME"
# Stop and remove all containers, networks, and volumes associated with the compose file
docker-compose down --volumes --remove-orphans
echo "Removing all volumes for the project if exist..."
docker volume inspect "${PROJECT_NAME}_pg_data_queryshield" >/dev/null 2>&1 && \
docker volume rm "${PROJECT_NAME}_pg_data_queryshield" || \
echo "Volume ${PROJECT_NAME}_pg_data_queryshield does not exist, skipping..."
docker volume inspect "${PROJECT_NAME}_pg_data_verification" >/dev/null 2>&1 && \
docker volume rm "${PROJECT_NAME}_pg_data_verification" || \
echo "Volume ${PROJECT_NAME}_pg_data_verification does not exist, skipping..."
echo "Removing app image..."
docker rmi $APP_IMAGE
echo "Removing dangling volumes..."
docker volume prune -f
echo "Removing dangling images..."
docker image prune -f
echo "Cleanup complete!"