You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Ubuntu in DistroBox on Fedora, my docker compose configurations are not interpolating variables found in the shell environment for the docker compose command. I'd expect shell variables to be interpolated into the docker compose configuration.
The reproduction below is a minimal example to exemplify the issue. In my full usage, the Makefile has over a dozen targets each serving as a different bundle of command-level shell variables to apply to my docker compose configuration (make test >> 0.5kb of test commands). The "command-level" piece is important so that running one make target doesn't modify the shell environment used by other targets.
Interpolation works as expected on a different device running Ubuntu in WSL2 on Windows 11.
Steps To Reproduce
docker-compose.yml
services:
sample:
image: ubuntuenvironment:
- LOOK_AT_ME=${LOOK_AT_ME:-default in compose file}command: printenv
Makefile
test:
@echo "------------ENV for docker compose--------------"
@LOOK_AT_ME="value from makefile"\
printenv | grep LOOK_AT_ME
@echo "------------CONFIG of docker compose--------------"
@LOOK_AT_ME="value from makefile"\
docker compose config
@echo "------------OUTPUT of docker compose--------------"
@LOOK_AT_ME="value from makefile"\
docker compose up
❌ Broken Example - Ubuntu in DistroBox on Fedora
$ make test
------------ENV for docker compose--------------
LOOK_AT_ME=value from makefile <--- ✅ Looks good
------------CONFIG of docker compose--------------
name: test
services:
sample:
command:
- printenv
environment:
LOOK_AT_ME: default in compose file <--- ❌ Undesired
image: ubuntu
networks:
default: null
networks:
default:
name: test_default
------------OUTPUT of docker compose--------------
[+] Running 1/1
✔ Container test-sample-1 Recreated 0.3s
Attaching to sample-1
sample-1 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sample-1 | HOSTNAME=43cd10a1d562
sample-1 | LOOK_AT_ME=default in compose file <--- ❌ Undesired
sample-1 | HOME=/root
sample-1 exited with code 0
✅ Working Example - Ubuntu in WSL2 on Windows 11
$ make test
------------ENV for docker compose--------------
LOOK_AT_ME=value from makefile <--- ✅ Looks good
------------CONFIG of docker compose--------------
name: docker-compose-bug-demo
services:
sample:
command:
- printenv
environment:
LOOK_AT_ME: value from makefile <--- ✅ Looks good
image: ubuntu
networks:
default: null
networks:
default:
name: docker-compose-bug-demo_default
------------OUTPUT of docker compose--------------
[+] Running 1/0
✔ Container docker-compose-bug-demo-sample-1 Created 0.0s
Attaching to sample-1
sample-1 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sample-1 | HOSTNAME=c44bfe42ea68
sample-1 | LOOK_AT_ME=value from makefile <--- ✅ Looks good
sample-1 | HOME=/root
sample-1 exited with code 0
Compose Version
**❌ Broken Example - Ubuntu in DistroBox on Fedora**
$ docker compose version
Docker Compose version v2.32.1
$ docker-compose version
# no output
**✅ Working Example - Ubuntu in WSL2 on Windows 11**
$ docker compose version
Docker Compose version v2.32.1
$ docker-compose version
zsh: command not found: docker-compose
Description
On Ubuntu in DistroBox on Fedora, my docker compose configurations are not interpolating variables found in the shell environment for the docker compose command. I'd expect shell variables to be interpolated into the docker compose configuration.
The reproduction below is a minimal example to exemplify the issue. In my full usage, the
Makefile
has over a dozen targets each serving as a different bundle of command-level shell variables to apply to my docker compose configuration (make test
>>0.5kb of test commands
). The "command-level" piece is important so that running onemake
target doesn't modify the shell environment used by other targets.Interpolation works as expected on a different device running Ubuntu in WSL2 on Windows 11.
Steps To Reproduce
docker-compose.yml
Makefile
❌ Broken Example - Ubuntu in DistroBox on Fedora
✅ Working Example - Ubuntu in WSL2 on Windows 11
Compose Version
Docker Environment
Anything else?
Additional system information that may be relevant.
❌ Broken Example - Ubuntu in DistroBox on Fedora
$ uname --all Linux HOSTNAME_REDACTED 6.11.8-300.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 14 20:37:39 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux $ lsb_release -d No LSB modules are available. Description: Ubuntu 24.04.1 LTS
✅ Working Example - Ubuntu in WSL2 on Windows 11
$ uname --all Linux HOSTNAME_REDACTED 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux $ lsb_release -d No LSB modules are available. Description: Ubuntu 24.04.1 LTS
I'm happy to provide additional context and debugging info as requested.
The text was updated successfully, but these errors were encountered: