Question

Is is the bug that docker appliance does not pass COMPOSE_FILE into docker-compose?

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

Run docker-compose in a container

This script will attempt to mirror the host paths by using volumes for the

following paths:

* $(pwd)

* $(dirname $COMPOSE_FILE) if it’s set

* $HOME if it’s set

You can add additional volumes (or any docker run options) using

the $COMPOSE_OPTIONS environment variable.

set -e

VERSION=“1.13.0” IMAGE=“docker/compose:$VERSION”

Setup options for connecting to docker host

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

Setup volume mounts for compose config and context

if [ “$(pwd)” != ‘/’ ]; then VOLUMES=“-v $(pwd):$(pwd)” fi if [ -n “$COMPOSE_FILE” ]; then compose_dir=$(realpath $(dirname $COMPOSE_FILE)) fi

TODO: also check --file argument

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

Only allocate tty if we detect one

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


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I can’t edit my question to fix its formatting?!