Browse Source

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 <valentin.lab@kalysto.org>
lokavaluto/dev/master
Valentin Lab 5 years ago
parent
commit
813dd0c06b
  1. 17
      bin/compose

17
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
}

Loading…
Cancel
Save