From 813dd0c06bfb7ceeef996703210e09bce9dca18c Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 28 Nov 2019 17:16:43 +0100 Subject: [PATCH] new: enter fully setup compose image for debug With ``ENTER=1``, one can enter the fully configured container instead of launching compose. Signed-off-by: Valentin Lab --- bin/compose | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/compose b/bin/compose index c4315bb..e75519e 100755 --- a/bin/compose +++ b/bin/compose @@ -665,12 +665,23 @@ run() { debug "${WHITE}Launching:${NORMAL}" echo "docker run --rm \\" pretty_print "${docker_run_opts[@]}" | sed -r 's/^/ /g;s/([^\])$/\1\\\n/g' - echo " ${COMPOSE_DOCKER_IMAGE} \\" - echo " " "$@" + if [ -z "$ENTER" ]; then + echo " ${COMPOSE_DOCKER_IMAGE} \\" + echo " " "$@" + else + echo " --entrypoint bash \\" + echo " ${COMPOSE_DOCKER_IMAGE}" + fi fi | { if [ -n "$DEBUG" ]; then sed -r 's/^/ /g'; else cat; fi } >&2 if [ -z "$DRY_RUN" ]; then debug "${WHITE}Execution:${NORMAL}" - exec docker run --rm "${docker_run_opts[@]}" "${COMPOSE_DOCKER_IMAGE}" "$@" + if [ -z "$ENTER" ]; then + exec docker run --rm "${docker_run_opts[@]}" "${COMPOSE_DOCKER_IMAGE}" "$@" + else + exec docker run --rm "${docker_run_opts[@]}" \ + --entrypoint bash \ + "${COMPOSE_DOCKER_IMAGE}" + fi fi }