-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstop-all.sh
executable file
·36 lines (31 loc) · 1.09 KB
/
stop-all.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
#!/bin/bash
# Function to check if a container is running
is_container_running() {
docker ps --filter "name=$1" --format '{{.Names}}' | grep -w "$1" > /dev/null 2>&1
}
# Stop containers if they are running
if is_container_running rate-limited-service-03; then
echo "Stopping rate-limited-service-03..."
docker stop rate-limited-service-03
else
echo "Container rate-limited-service-03 is not running."
fi
if is_container_running rate-limited-service-10; then
echo "Stopping rate-limited-service-10..."
docker stop rate-limited-service-10
else
echo "Container rate-limited-service-10 is not running."
fi
if is_container_running pricing-service; then
echo "Stopping pricing-service..."
docker stop pricing-service
else
echo "Container pricing-service is not running."
fi
# Remove network if it exists
if docker network ls --filter "name=pricing-network" --format '{{.Name}}' | grep -w "pricing-network" > /dev/null 2>&1; then
echo "Removing network pricing-network..."
docker network rm pricing-network
else
echo "Network pricing-network does not exist."
fi