Skip to content

[BUG] --no-path-resolution ineffective when using include #11508

@luciangabor

Description

@luciangabor

Description

When an included file contains relative paths (at least) for build contexts or volume definitions, docker compose config --no-path-resolution outputs the full paths. It doesn't look like a regression, maybe a missing feature, but nevertheless, please see below.

Steps To Reproduce

  1. Create the compose.yaml
include:
  - path: included.yaml

services:
  extended:
    extends:
      file: included.yaml
      service: included
  1. Create an included.yaml
services:
  included:
    build: .
    volumes:
      - ./:/mnt
  1. Observe the output of the config command
$ docker compose config --no-path-resolution
name: inc
services:
  extended:
    build:
      context: .
      dockerfile: Dockerfile
    networks:
      default: null
    volumes:
      - type: bind
        source: .
        target: /mnt
        bind:
          create_host_path: true
  included:
    build:
      context: /path/to/inc
      dockerfile: Dockerfile
    networks:
      default: null
    volumes:
      - type: bind
        source: /path/to/inc
        target: /mnt
        bind:
          create_host_path: true
networks:
  default:
    name: inc_default

The example is set up so that what's actually the same service gets presented in different ways.

Compose Version

Docker Compose version v2.24.6

Docker Environment

No response

Anything else?

No response

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