Compose: docker-compose --project-directory project up not working as expected

Created on 31 Oct 2018  路  7Comments  路  Source: docker/compose

Description of the issue

This issue relates to changes introduced by docker/compose/pull/6134

The understanding is that --project-directory will allow you run start up a docker-compose from another directory by specifying the 'project directory'. The understanding is that it will also load the .env file within that directory.

This pull request is only included in the latest release so ensure you're using docker-compose from docker/[email protected] (release).

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.23.0-rc3, build ea3d406e
docker-py version: 3.5.0
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.1.0h  27 Mar 2018

Output of docker version

Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:21:31 2018
 OS/Arch:           darwin/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:29:02 2018
  OS/Arch:          linux/amd64
  Experimental:     true

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

services:
  java:
    command: java -version
    image: java:alpine
version: '3.1'

Steps to reproduce the issue

  1. Clone https://github.com/benjefferies/docker-compose-project-directory
  2. Run docker-compose --project-directory docker up or docker-compose --project-directory docker -f docker/docker-compose.yml up

Observed result

Docker container does not run

Expected result

docker container to run using .env within the docker directory

Stacktrace / full error message

ERROR:
WARNING: The TAG variable is not set. Defaulting to a blank string.
ERROR: no such image: java:: invalid reference format

Additional information

See README.md in https://github.com/benjefferies/docker-compose-project-directory

arecli kinbug

Most helpful comment

i have same problem, i tried with --verbose and relative path too and not working. --project-directory doesnt change the $PWD

All 7 comments

Thanks for the report, and repro case, we'll look into it!

@shin- I seem to be running into this again:

D:\Checkout\@cloud-technologies\core-pkg (feature/157 -> origin)
位 docker-compose --verbose --project-directory .\.docker\core-local-infrastructure\ up
compose.config.config.find: Using configuration files: .\docker-compose.yml,.\docker-compose.override.yml
docker.utils.config.find_config_file: Trying paths: ['C:\\Users\\mmisztal\\.docker\\config.json', 'C:\\Users\\mmisztal\\.dockercfg']
docker.utils.config.find_config_file: Found file at path: C:\Users\mmisztal\.docker\config.json
docker.auth.load_config: Found 'auths' section
docker.auth.parse_auth: Auth data for cloudtechnologies.azurecr.io is absent. Client might be using a credentials store instead.
docker.auth.load_config: Found 'credsStore' section
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.35/version HTTP/1.1" 200 549
compose.cli.command.get_client: docker-compose version 1.22.0, build f46880fe
docker-py version: 3.4.1
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.0.2o  27 Mar 2018
compose.cli.command.get_client: Docker base_url: http+docker://localnpipe
compose.cli.command.get_client: Docker version: Platform={'Name': ''}, Components=[{'Name': 'Engine', 'Version': '18.06.1-ce', 'Details': {'ApiVersion': '1.38', 'Arch': 'amd64', 'BuildTime': '2018-08-21T17:29:02.000000000+00:00', 'Experimental': 'false', 'GitCommit': 'e68fc7a', 'GoVersion': 'go1.10.3', 'KernelVersion': '4.9.93-linuxkit-aufs', 'MinAPIVersion': '1.12', 'Os': 'linux'}}], Version=18.06.1-ce, ApiVersion=1.38, MinAPIVersion=1.12, GitCommit=e68fc7a, GoVersion=go1.10.3, Os=linux, Arch=amd64, KernelVersion=4.9.93-linuxkit-aufs, BuildTime=2018-08-21T17:29:02.000000000+00:00
compose.cli.verbose_proxy.proxy_callable: docker info <- ()
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.35/info HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker info -> {'Architecture': 'x86_64',
 'BridgeNfIp6tables': True,
 'BridgeNfIptables': True,
 'CPUSet': True,
 'CPUShares': True,
 'CgroupDriver': 'cgroupfs',
 'ClusterAdvertise': '',
 'ClusterStore': '',
 'ContainerdCommit': {'Expected': '468a545b9edcd5932818eb9de8e72413e616e86e',
                      'ID': '468a545b9edcd5932818eb9de8e72413e616e86e'},
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=core-local-infrastructure', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.35/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dcore-local-infrastructure%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=corelocalinfrastructure', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.35/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dcorelocalinfrastructure%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.parallel.feed_queue: Pending: set()
Attaching to

The core-local-infrastructure folder contains 2 valid docker-compose*.yml files. No containers are being started when --project-dir is used

i have same problem, i tried with --verbose and relative path too and not working. --project-directory doesnt change the $PWD

docker-compose version 1.17.1
Docker version 19.03.12

The same:

ERROR: 
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

Project structure:

myRoot /
  subdir /
    docker-compose.yml

commands:
pwd => /home/me/myRoot
docker-compose --project-directory "./subdir" => error
docker-compose --project-directory "~/subdir" => error
docker-compose --project-directory "/home/me/myRoot/subdir => error

The problem mentioned by @fider is also present in the latest release.

# docker-compose version
docker-compose version 1.26.2, build eefe0d31
docker-py version: 4.2.2
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
# docker-compose -p nginx --project-directory /srv/containers/nginx up -d --remove-orphans
ERROR:
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

I'm facing the same issue.

Did it ever work?

Was this page helpful?
0 / 5 - 0 ratings