Skip to content

[BUG] including files with a custom project directory breaks when compose is run from a nested folder #11573

@luciangabor

Description

@luciangabor

Description

Please see the steps below.

Steps To Reproduce

  1. With these compose.yaml, dir/included.yaml and dir/extended.yaml files:
---
# compose.yaml
include:
  - project_directory: .
    path: dir/included.yaml

---
# dir/included.yaml
services:
  included:
    extends:
      file: dir/extended.yaml
      service: extended

---
# dir/extended.yaml
services:
  extended:
    image: image
  1. Observe the output of the config command when ran from . or dir:
$ docker compose config 
name: proj-dir
services:
  included:
    image: image
    networks:
      default: null
networks:
  default:
    name: proj-dir_default

$ env -C dir docker compose config 
cannot read dir/extended.yaml

Compose Version

Docker Compose version v2.24.6

Docker Environment

No response

Anything else?

Furthermore, in case of "double extends", I mean if dir/extended.yaml would look ... "as expected" ... like this:

services:
  extended:
    extends:
      file: dir/base.yaml
      service: base

with dir/base.yaml like this:

services:
  base:
    image: image

it would lead to:

$ docker compose config
cannot read dir/dir/base.yaml

Which could be fixed by mixing both ways of referring to files in dir, but ... I guess this has to wait and see if the very first extend was indeed supposed to be relative to the customized project directory anyway ...

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