Skip to content

Commit 3eadcd0

Browse files
author
Sengorius
committed
introduced a variable to override START_CONTAINER from outside; e.g. for using DockerExec in external scripts
1 parent de66c57 commit 3eadcd0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function get_compose_executable() {
120120
function compose_run() {
121121
local COMPOSE=$1
122122
local ENV_FILE=$2
123+
local INTERRUPT_START_CONTAINER=${INTERRUPT_START_CONTAINER:-no}
123124

124125
COMPOSE_EXEC=$(get_compose_executable)
125126

@@ -131,7 +132,9 @@ function compose_run() {
131132
local START_CONTAINER
132133
START_CONTAINER=$(grep "^START_CONTAINER=" "$ENV_FILE" | sed -e 's/^START_CONTAINER=//' | sed -e 's/[[:space:]]*$//')
133134

134-
if [[ -n "$START_CONTAINER" ]]; then
135+
if [[ "no" != "$INTERRUPT_START_CONTAINER" ]]; then
136+
echo "Interrupting to start a shell into container."
137+
elif [[ -n "$START_CONTAINER" ]]; then
135138
if [[ "none" != "$START_CONTAINER" ]]; then
136139
# retry sh, if bash is not found
137140
docker exec -it "${START_CONTAINER}" bash || \

0 commit comments

Comments
 (0)