Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the error to detect docker compose #52

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
#!/usr/bin/env bash

command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Check if 'docker compose' is available (with space)
if command_exists "docker compose"; then
# Check if 'docker compose' is available
if docker compose version >/dev/null 2>&1; then
DOCKER_COMPOSE_CMD="docker compose"
elif docker-compose version >/dev/null 2>&1; then
# Fallback to 'docker-compose' if 'docker compose' is not available
DOCKER_COMPOSE_CMD="docker-compose"
else
# Check if 'docker-compose' is available
if command_exists docker-compose; then
DOCKER_COMPOSE_CMD="docker-compose"
else
echo "Error: Neither 'docker-compose' nor 'docker compose' is available. Please install Docker Compose."
exit 1
fi
echo "Error: Neither 'docker-compose' nor 'docker compose' is available. Please install Docker Compose."
exit 1
fi

# Run the Docker Compose command with any passed arguments
$DOCKER_COMPOSE_CMD up "${@:1}"