From 16ec7468dff1e630504a1b0a83a1a64ec64f30c6 Mon Sep 17 00:00:00 2001 From: DebasishBarai Date: Tue, 10 Jun 2025 11:20:28 +0530 Subject: [PATCH] Fix: Failed to run postgres docker container if it is stopped condition during ./setup.sh run --- setup.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.sh b/setup.sh index 703d48eff..33cb91148 100755 --- a/setup.sh +++ b/setup.sh @@ -1,6 +1,12 @@ # Copies .env.example and changes it to .env so that future commands can find the env file cp .env.example .env +# If the container is already running or exists, stop and remove it +if [ "$(docker ps -aq -f name=cms-db)" ]; then + echo "Stopping and removing existing cms-db container..." + docker stop cms-db + docker rm cms-db +fi # Start PostgreSQL container docker run -d \