diff --git a/mwaa-local-env b/mwaa-local-env index 61a4242fa..c39ef8791 100755 --- a/mwaa-local-env +++ b/mwaa-local-env @@ -3,6 +3,13 @@ AIRFLOW_VERSION=2_6 DOCKER_COMPOSE_PROJECT_NAME=aws-mwaa-local-runner-$AIRFLOW_VERSION +# Check if using docker compose v1 or v2 +if command -v docker-compose &> /dev/null; then + DOCKER_COMPOSE=docker-compose +else + DOCKER_COMPOSE="docker compose" +fi + display_help() { # Display Help echo "======================================" @@ -30,7 +37,7 @@ validate_prereqs() { echo -e "Docker is Installed. \xE2\x9C\x94" fi - docker-compose -v >/dev/null 2>&1 + $DOCKER_COMPOSE -v >/dev/null 2>&1 if [ $? -ne 0 ]; then echo -e "'docker-compose' is not installed. \xE2\x9D\x8C" else @@ -94,10 +101,10 @@ build-image) build_image ;; reset-db) - docker-compose -p $DOCKER_COMPOSE_PROJECT_NAME -f ./docker/docker-compose-resetdb.yml up --abort-on-container-exit + $DOCKER_COMPOSE -p $DOCKER_COMPOSE_PROJECT_NAME -f ./docker/docker-compose-resetdb.yml up --abort-on-container-exit ;; start) - docker-compose -p $DOCKER_COMPOSE_PROJECT_NAME -f ./docker/docker-compose-local.yml up + $DOCKER_COMPOSE -p $DOCKER_COMPOSE_PROJECT_NAME -f ./docker/docker-compose-local.yml up ;; help) display_help