Browse Source

pass COMPOSE_PROJECT_NAME env var in container mode

Avoids the surprise of finding the project name set to the directory
name when COMPOSE_PROJECT_NAME is being used.

Signed-off-by: Santiago M. Mola <[email protected]>
Santiago M. Mola 5 years ago
parent
commit
0ea51906cd
1 changed files with 3 additions and 0 deletions
  1. 3 0
      script/run/run.sh

+ 3 - 0
script/run/run.sh

@@ -38,6 +38,9 @@ if [ -n "$COMPOSE_FILE" ]; then
     COMPOSE_OPTIONS="$COMPOSE_OPTIONS -e COMPOSE_FILE=$COMPOSE_FILE"
     compose_dir=$(realpath "$(dirname "$COMPOSE_FILE")")
 fi
+if [ -n "$COMPOSE_PROJECT_NAME" ]; then
+    COMPOSE_OPTIONS="-e COMPOSE_PROJECT_NAME $COMPOSE_OPTIONS"
+fi
 # TODO: also check --file argument
 if [ -n "$compose_dir" ]; then
     VOLUMES="$VOLUMES -v $compose_dir:$compose_dir"