root@towergame:~/ops-meta/filmtower/COMPOSE# COMPOSE_FILE=nginx.yaml docker-compose --verbose up -d compose.config.config.find: Using configuration files: ./docker-compose.yaml docker.auth.find_config_file: Trying paths: [‘/root/.docker/config.json’, ‘/root/.dockercfg’] docker.auth.find_config_file: No config file found compose.cli.command.get_client: docker-compose version 1.13.0, build 1719ceb docker-py version: 2.2.1 CPython version: 2.7.13 OpenSSL version: OpenSSL 1.0.1t 3 May 2016 compose.cli.command.get_client: Docker base_url: http+docker://localunixsocket compose.cli.command.get_client: Docker version: KernelVersion=4.4.0-97-generic, Arch=amd64, BuildTime=2017-05-04T22:10:54.638119411+00:00, ApiVersion=1.29, Version=17.05.0-ce, MinAPIVersion=1.12, GitCommit=89658be, Os=linux, GoVersion=go1.7.5 compose.cli.verbose_proxy.proxy_callable: docker info <- () …snip… root@towergame:~/ops-meta/filmtower/COMPOSE#
As you see, COMPOSE_FILE is not taken into account. As you run docker-compose via docker using a script:
root@towergame:~/ops-meta/filmtower/COMPOSE# cat /usr/local/bin/docker-compose #!/bin/sh
set -e
VERSION=“1.13.0” IMAGE=“docker/compose:$VERSION”
if [ -z “$DOCKER_HOST” ]; then DOCKER_HOST=“/var/run/docker.sock” fi if [ -S “$DOCKER_HOST” ]; then DOCKER_ADDR=“-v $DOCKER_HOST:$DOCKER_HOST -e DOCKER_HOST” else DOCKER_ADDR=“-e DOCKER_HOST -e DOCKER_TLS_VERIFY -e DOCKER_CERT_PATH” fi
if [ “$(pwd)” != ‘/’ ]; then VOLUMES=“-v $(pwd):$(pwd)” fi if [ -n “$COMPOSE_FILE” ]; then compose_dir=$(realpath $(dirname $COMPOSE_FILE)) fi
if [ -n “$compose_dir” ]; then VOLUMES=“$VOLUMES -v $compose_dir:$compose_dir” fi if [ -n “$HOME” ]; then VOLUMES=“$VOLUMES -v $HOME:$HOME -v $HOME:/root” # mount $HOME in /root to share docker.config fi
if [ -t 1 ]; then DOCKER_RUN_OPTIONS=“-t” fi if [ -t 0 ]; then DOCKER_RUN_OPTIONS=“$DOCKER_RUN_OPTIONS -i” fi
exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $COMPOSE_OPTIONS $VOLUMES -w “$(pwd)” $IMAGE “$@” root@towergame:~/ops-meta/filmtower/COMPOSE#
this is no coincidence: I don’t see where COMPOSE_FILE is passed; not to mention it fails when it contains multiple files with separator and paths:
root@towergame:~/ops-meta/filmtower/COMPOSE# COMPOSE_FILE=“./docker-compose.yaml:./nginx.yaml” docker-compose --verbose up -d docker: Error response from daemon: invalid bind mount spec “/root/ops-meta/filmtower/COMPOSE/docker-compose.yaml:.:/root/ops-meta/filmtower/COMPOSE/docker-compose.yaml:.”: invalid volume specification: ‘/root/ops-meta/filmtower/COMPOSE/docker-compose.yaml:.:/root/ops-meta/filmtower/COMPOSE/docker-compose.yaml:.’. See ‘docker run --help’. root@towergame:~/ops-meta/filmtower/COMPOSE#
Question: Do you plan to fix this and make docker-compose honour COMPOSE_FILE as in docker-compose docs?
Thanks, Herby
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I can’t edit my question to fix its formatting?!