Description
Please see the steps below
Steps To Reproduce
- Create the
compose.yaml
services:
service:
network_mode: none
image: bash
entrypoint:
- bash
- -vc
command:
- echo "FOO:$${FOO:-default}, BAR:$${BAR:-default}"
environment:
FOO: ${FOO:-}
BAR:
- Experiment with setting or not the two variables
$ docker compose config --no-interpolate
name: interpolate
services:
service:
command:
- echo "FOO:$${FOO:-default}, BAR:$${BAR:-default}"
entrypoint:
- bash
- -vc
environment:
BAR: null
FOO: ${FOO:-}
image: bash
network_mode: none
$ env FOO=FOO BAR=BAR docker compose config --no-interpolate
name: interpolate
services:
service:
command:
- echo "FOO:$${FOO:-default}, BAR:$${BAR:-default}"
entrypoint:
- bash
- -vc
environment:
BAR: BAR
FOO: ${FOO:-}
image: bash
network_mode: none
Observe that BAR is "interpolated" despite the flag, while both ways to pass a homonym variables work more or less the same:
$ docker compose --progress none up --no-log-prefix
Attaching to service-1
echo "FOO:${FOO:-default}, BAR:${BAR:-default}"
FOO:default, BAR:default
service-1 exited with code 0
$ env FOO=FOO BAR=BAR docker compose --progress none up --no-log-prefix
Attaching to service-1
echo "FOO:${FOO:-default}, BAR:${BAR:-default}"
FOO:FOO, BAR:BAR
service-1 exited with code 0
Compose Version
Docker Compose version v2.24.6
Docker Environment
No response
Anything else?
No response
Description
Please see the steps below
Steps To Reproduce
compose.yamlObserve that BAR is "interpolated" despite the flag, while both ways to pass a homonym variables work more or less the same:
Compose Version
Docker Environment
No response
Anything else?
No response