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: adjust docker compose cmd for v1 and v2 #309

Open
wants to merge 1 commit into
base: v2.6.3
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
13 changes: 10 additions & 3 deletions mwaa-local-env
Original file line number Diff line number Diff line change
Expand Up @@ -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 "======================================"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down