compose-spec / compose-go

Reference library for parsing and loading Compose YAML files

Home Page:https://compose-spec.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Environment fallback not working in .env file.

GerbenLimburg opened this issue · comments

Given system variable SYS_VAR=the_value when set:
and an .env file:
Some__env__var=${SYS_VAR:-fallback}

Using docker-compose v1.29.2, this results in either:
Some__env__var=the_value when SYS_VAR has a value or
Some__env__var=fallback when SYS_VAR is not set or is empty.

In docker compose v2.2.3 this results in
Some__env__var=the_value:-fallback when SYS_VAR has a value or
Some__env__var=:-fallback when SYS_VAR is not set or is empty.

To me, the behaviour in v2.2.3 is unexpected.

This is fixed in more recent versions of Compose v2.

We are also working on clarifying and formalizing the spec here around interpolation behavior, as the spec is currently inaccurate.