Skip to content

v2.7 expands .env file values #9704

@antonagestam

Description

@antonagestam

In prior versions, this .env file would result in the variable BASIC_AUTH_CLIENTS being set to the value {"a_client":"md5$ldjDcN3a5x7x$46b3330841bbe4974ef43cb8b97034e"}:

BASIC_AUTH_CLIENTS={"a_client":"md5$ldjDcN3a5x7x$46b3330841bbe4974ef43cb8b97034e"}

In version 2.7 this results in the following error message:

WARN[0000] The "ldjDcN3a5x7x" variable is not set. Defaulting to a blank string. 
Invalid template: "{\"a_client\":\"md5$ldjDcN3a5x7x$46b3330841bbe4974ef43cb8b97034e\"}"

.env files used to be "dumb" and not allow any expansions, which is a rigid but stable behavior. This change is problematic because it isn't backwards compatible, and will require synchronized upgrades across environments.

Output of docker compose version:

Docker Compose version v2.7.0

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