fix : start_services.sh not supporting newest docker compose (#137)

This commit is contained in:
martin legrand 2025-04-29 12:01:56 +02:00
parent bb15199b4e
commit 7dd60a8946

View File

@ -41,13 +41,19 @@ else
fi fi
# Check if Docker Compose is installed # Check if Docker Compose is installed
if ! command_exists docker-compose; then if ! command_exists docker-compose && ! docker compose version >/dev/null 2>&1; then
echo "Error: Docker Compose is not installed. Please install it first." echo "Error: Docker Compose is not installed. Please install it first."
echo "On Ubuntu: sudo apt install docker-compose" echo "On Ubuntu: sudo apt install docker-compose"
echo "Or via pip: pip install docker-compose" echo "Or via pip: pip install docker-compose"
exit 1 exit 1
fi fi
if command_exists docker-compose; then
COMPOSE_CMD="docker-compose"
else
COMPOSE_CMD="docker compose"
fi
# Check if docker-compose.yml exists # Check if docker-compose.yml exists
if [ ! -f "docker-compose.yml" ]; then if [ ! -f "docker-compose.yml" ]; then
echo "Error: docker-compose.yml not found in the current directory." echo "Error: docker-compose.yml not found in the current directory."
@ -60,8 +66,8 @@ sleep 4
docker stop $(docker ps -a -q) docker stop $(docker ps -a -q)
echo "All containers stopped" echo "All containers stopped"
if ! docker-compose up; then if ! $COMPOSE_CMD up; then
echo "Error: Failed to start containers. Check Docker logs with 'docker compose logs'." echo "Error: Failed to start containers. Check Docker logs with '$COMPOSE_CMD logs'."
echo "Possible fixes: Run with sudo or ensure port 8080 is free." echo "Possible fixes: Run with sudo or ensure port 8080 is free."
exit 1 exit 1
fi fi