From c9f8f2b3e4361648aa0c4a35aa3e920b5b5bab6f Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 12 Sep 2019 21:58:03 +0200 Subject: [PATCH] fix: keep ``COMPOSE_DOCKER_IMAGE`` in subcalls. --- bin/compose | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/compose b/bin/compose index 5fa1fe1..70796a0 100755 --- a/bin/compose +++ b/bin/compose @@ -167,6 +167,9 @@ mk_docker_run_options() { docker_run_opts+=("-v" "$HOME/.docker:/root/.docker") + COMPOSE_DOCKER_IMAGE=${COMPOSE_DOCKER_IMAGE:-docker.0k.io/compose} + docker_run_opts+=("-e" "COMPOSE_DOCKER_IMAGE=$COMPOSE_DOCKER_IMAGE") + COMPOSE_LAUNCHER_BIN=$(readlink -f "${BASH_SOURCE[0]}") filename=$(mktemp -p /tmp/ -t launch_opts-XXXXXXXXXXXXXXXX) @@ -196,9 +199,16 @@ run() { while read-0 opt; do docker_run_opts+=("$opt") + ## catch COMPOSE_DOCKER_IMAGE + if [[ "$env" == "true" && "$opt" == "COMPOSE_DOCKER_IMAGE="* ]]; then + COMPOSE_DOCKER_IMAGE=${opt##COMPOSE_DOCKER_IMAGE=} + elif [ "$opt" == "-e" ]; then + env=true + else + env= + fi done < <(cat "$COMPOSE_LAUNCHER_OPTS") - COMPOSE_DOCKER_IMAGE=${COMPOSE_DOCKER_IMAGE:-docker.0k.io/compose} if [ -t 0 ]; then docker_run_opts+=("-i") fi