xonecas.io
53129
Pa

PAT / files

PAT / scripts / stop-docker.sh

591 bytes
1#!/usr/bin/env bash
2set -euo pipefail
3
4# Stop Valkey container if it exists
5if docker ps -a --format '{{.Names}}' | grep -q '^valkey$'; then
6  echo "Stopping Valkey container..."
7  docker stop valkey
8  echo "Valkey container stopped."
9else
10  echo "Valkey container not found."
11fi
12
13# Stop PostgreSQL container if it exists
14if docker ps -a --format '{{.Names}}' | grep -q '^postgres$'; then
15  echo "Stopping PostgreSQL container..."
16  docker stop postgres
17  echo "PostgreSQL container stopped."
18else
19  echo "PostgreSQL container not found."
20fi
21
22echo "Docker containers stopped successfully!"
23