Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Compose parsing commented out yaml for env vars #2028

@beyondmeat

Description

@beyondmeat

Description

I discovered that commented out yaml that contain env vars in the comment do get parsed in RC1. This seems to be a bug introduced by the recent env changes.

for example a commented out docker label, demoted by #

# traefik.http.routers.dashboard.rule: Host(`${TRAEFIK_CNAME}.localhost`, `${TRAEFIK_CNAME}.local.${DOMAIN}`)

It will output warn on pull or up about the env variable. The env var isn't used or referenced by anything that isn't commented out.

have valid yml that uses a env variable
comment out the line in the yml, (line starting with #)
run docker compose pull to
Steps to reproduce the issue:

  1. Create docker compose and use env file with env var
  2. Comment out a line that uses a unique env var
  3. Run pull or up

Describe the results you received:
see variable is not set. Defaulting to a blank string warning.

Describe the results you expected:
Not to see a warning. Compose must be parsing commented out yaml lines in it's env parsing code as that is the likely explanation.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker-compose --version:

RC1

Output of docker version:

Docker version 20.10.8, build 3967b7d

Output of docker context show:
You can also run docker context inspect context-name to give us more details but don't forget to remove sensitive content.


Output of docker info:

(paste your output here)

Additional environment details (AWS ECS, Azure ACI, local, etc.):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions