Skip to content

[BUG] config --no-interpolate with default values #13327

@jprince14

Description

@jprince14

Description

There is a bug with docker compose config --no-interpolate that is seen when variables have default values.

Steps To Reproduce

Using this config as an example

services:
  client:
    image: hello-world
    volumes:
      - /tmp:/tmp/${BUG_HERE:-DEFAULT}/path
      - /tmp:/tmp/${WORKS_AS_EXPECTED}/path

When I call docker compose config everything works as expected, the volumes I see are

    volumes:
      - type: bind
        source: /tmp
        target: /tmp/DEFAULT/path
        bind:
          create_host_path: true
      - type: bind
        source: /tmp
        target: /tmp/path
        bind:
          create_host_path: true

The bug occurs when i call docker compose config --no-interpolate, There is an issues with the volume that contains the default value

    volumes:
      - bind:
          create_host_path: true
        source: /tmp
        target: /tmp/${BUG_HERE
        type: bind
      - bind:
          create_host_path: true
        source: /tmp
        target: /tmp/${WORKS_AS_EXPECTED}/path
        type: bind

The output I was expecting to see from docker compose config --no-interpolate is

    volumes:
      - bind:
          create_host_path: true
        source: /tmp
        target: /tmp/${BUG_HERE:-DEFAULT}/path
        type: bind
      - bind:
          create_host_path: true
        source: /tmp
        target: /tmp/${WORKS_AS_EXPECTED}/path
        type: bind

Compose Version

2.40.2

Docker Environment


Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions