mirror of https://github.com/docker/compose.git
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 <santi@mola.io>
This commit is contained in:
parent
c17ef995b4
commit
0ea51906cd
|
@ -38,6 +38,9 @@ if [ -n "$COMPOSE_FILE" ]; then
|
||||||
COMPOSE_OPTIONS="$COMPOSE_OPTIONS -e COMPOSE_FILE=$COMPOSE_FILE"
|
COMPOSE_OPTIONS="$COMPOSE_OPTIONS -e COMPOSE_FILE=$COMPOSE_FILE"
|
||||||
compose_dir=$(realpath "$(dirname "$COMPOSE_FILE")")
|
compose_dir=$(realpath "$(dirname "$COMPOSE_FILE")")
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$COMPOSE_PROJECT_NAME" ]; then
|
||||||
|
COMPOSE_OPTIONS="-e COMPOSE_PROJECT_NAME $COMPOSE_OPTIONS"
|
||||||
|
fi
|
||||||
# TODO: also check --file argument
|
# TODO: also check --file argument
|
||||||
if [ -n "$compose_dir" ]; then
|
if [ -n "$compose_dir" ]; then
|
||||||
VOLUMES="$VOLUMES -v $compose_dir:$compose_dir"
|
VOLUMES="$VOLUMES -v $compose_dir:$compose_dir"
|
||||||
|
|
Loading…
Reference in New Issue