File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -26,13 +26,23 @@ cd "$PROJECT_DIR" || {
2626# Extract the last part of the directory path to use as a human-readable name
2727PROJECT_NAME=$( basename " $PROJECT_DIR " )
2828
29+ # Detect whether to use 'docker compose' or 'docker-compose'
30+ if docker compose version > /dev/null 2>&1 ; then
31+ COMPOSE_CMD=" docker compose"
32+ elif command -v docker-compose > /dev/null 2>&1 ; then
33+ COMPOSE_CMD=" docker-compose"
34+ else
35+ echo " ERROR: Neither 'docker compose' nor 'docker-compose' was found on this system."
36+ exit 1
37+ fi
38+
2939# Tear down the running stack, including named volumes
3040echo " Stopping and removing current containers and volumes for '$PROJECT_NAME '..."
31- docker compose down --volumes
41+ $COMPOSE_CMD down -v
3242
3343# Rebuild and start the stack in detached mode
3444echo " Rebuilding and starting containers for '$PROJECT_NAME ' with enforced startup order..."
35- docker compose up -d
45+ $COMPOSE_CMD up -d
3646
3747# Report success
3848echo " '$PROJECT_NAME ' stack restarted successfully."
You can’t perform that action at this time.
0 commit comments