Skip to content

[BUG] random build context path for services with a long(ish) chain of extends with compose 2.24.2 #11394

@luciangabor

Description

@luciangabor

Description

Please see the attached screen recording:

Screencast.from.2024-01-23.14-47-13.webm

Steps To Reproduce

  1. Create compose.yaml
services:
  service:
    extends:
      file: dir/file.yaml
      service: service
  1. Create dir/file.yaml
services:
  level1:
    build:
      context: ..

  level2:
    extends: level1

  service:
    extends: level2
    build:
      target: target
  1. Try to reproduce the issue
watch -n 0.1 docker compose config --no-path-resolution

For me, the behavior is as in the attached screen recording.
If the service from dir/file.yaml extends the level1 service instead, the problem disappears.
If the service from dir/file.yaml lacks the build block, I get, sometimes, the service "service" has neither an image nor a build context specified: invalid compose project error.

Compose Version

Docker Compose version v2.24.2

Docker Environment

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions