From 78cb06f99f15f4f4f90b57e3545f1dc0b222eaf3 Mon Sep 17 00:00:00 2001 From: Paul van der lei <54599584+0pilatos0@users.noreply.github.com> Date: Thu, 3 Oct 2024 12:36:00 +0200 Subject: [PATCH] fix: resolved database startup script not checking docker daemon status @0pilatos0 (#1975) --- .changeset/violet-elephants-sit.md | 5 +++++ cli/template/extras/start-database/mysql.sh | 5 +++++ cli/template/extras/start-database/postgres.sh | 5 +++++ 3 files changed, 15 insertions(+) create mode 100644 .changeset/violet-elephants-sit.md diff --git a/.changeset/violet-elephants-sit.md b/.changeset/violet-elephants-sit.md new file mode 100644 index 0000000000..ae72cc68c8 --- /dev/null +++ b/.changeset/violet-elephants-sit.md @@ -0,0 +1,5 @@ +--- +"create-t3-app": patch +--- + +Resolved issue where database startup script did not check for docker daemon being up and running diff --git a/cli/template/extras/start-database/mysql.sh b/cli/template/extras/start-database/mysql.sh index 268df5cc53..731725c31c 100755 --- a/cli/template/extras/start-database/mysql.sh +++ b/cli/template/extras/start-database/mysql.sh @@ -16,6 +16,11 @@ if ! [ -x "$(command -v docker)" ]; then exit 1 fi +if ! docker info > /dev/null 2>&1; then + echo "Docker daemon is not running. Please start Docker and try again." + exit 1 +fi + if [ "$(docker ps -q -f name=$DB_CONTAINER_NAME)" ]; then echo "Database container '$DB_CONTAINER_NAME' already running" exit 0 diff --git a/cli/template/extras/start-database/postgres.sh b/cli/template/extras/start-database/postgres.sh index 11fb2042ad..378f19e23c 100755 --- a/cli/template/extras/start-database/postgres.sh +++ b/cli/template/extras/start-database/postgres.sh @@ -16,6 +16,11 @@ if ! [ -x "$(command -v docker)" ]; then exit 1 fi +if ! docker info > /dev/null 2>&1; then + echo "Docker daemon is not running. Please start Docker and try again." + exit 1 +fi + if [ "$(docker ps -q -f name=$DB_CONTAINER_NAME)" ]; then echo "Database container '$DB_CONTAINER_NAME' already running" exit 0