Skip to content

Build context is wrong when COMPOSE_FILE is being used #5624

@achekulaev

Description

@achekulaev

When COMPOSE_FILE directive is being used, docker-compose uses wrong relative path/build context for build instructions.

Demonstration.
Directory /Users/alexei.chekulaev/tmp/bug_demo

Structure:

bug_demo/
  conf/
    docker-compose.yml
  build/
    Dockerfile

docker-compose.yml contents:

version: "2.1"

services:
  test:
    build: build

Actual result when building in /Users/alexei.chekulaev/tmp/bug_demo:

$ pwd
/Users/alexei.chekulaev/tmp/bug_demo

$ COMPOSE_FILE="conf/docker-compose.yml" docker-compose config
ERROR: build path /Users/alexei.chekulaev/tmp/bug_demo/conf/build either does not exist, is not accessible, or is not a valid URL.

So docker-compose was looking for build dir in /Users/alexei.chekulaev/tmp/bug_demo/conf which is wrong.

Expected result: docker-compose should use CWD as current path, not the path where first config file was found.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions