By herby
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
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!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.