Given:
services:
foo:
environment:
- BAR=test
labels:
- foo=${BAR}
Will results in:
WARNING: The BAR variable is not set. Defaulting to a blank string.
Instead of expected: label foo=test, no warning
The environment entry in the service refers to passing the BAR
variable to the service, not to be used to interpolate in the compose file. For this, the BAR
variable has to be present in the shell when running docker-compose
, for example:
$ BAR=test docker-compose up
I know, but what's the reason for not implementing this ?
Most helpful comment
I know, but what's the reason for not implementing this ?