-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in handling of environment variables #9492
Comments
Are you sure it was "working"in 2.5.0 ? I tried with 2.4.1, same results, however afaik it is intended, When documentation is speaking about shell environment variable, it speaks about shell inside the container, not shell starting docker, otherwise many others env variable will be changed and you don't want that (eg: Settings container shell variable works fine by using env file (as you did),
EDIT: Please ignore that comment, I can confirm the regression, I step back up until 2.2.3 and shell variable are well handled there, I'll look at it. |
@maxcleme The replacement of a variable set in Minimal setup as described by @camilledejoye Call without overwriting .env
Call with set variable (expected to be replaced)
Old / exptected behavior
|
Got it, I can confirm the regression, I step back up until 2.2.3 and shell variable are well handled there, I'll look at it. |
@maxcleme compose/cmd/compose/compose.go Lines 214 to 221 in 7e3564b
the order changed with 65b827d |
@ssc- Sure it is, I'm asking internally to better understand what was the motivation behind this, I highly doubt it was unintended. |
@ssc- @camilledejoye We just bump compose-go to latest version in order to integrate one remaining fix that was missing, are you able to try it out by building compose plugin locally ? There is still some edge cases that needs to be fixes, we are going to include new test cases for env variables in the next release, in the mean time I hope that using local build will fix your issues. |
@maxcleme yep, I can build/try locally, any particular branch or just HEAD (v2)? |
Thanks a lot @maxcleme, can confirm, works as expected now 👍
|
@maxcleme I confirm as well that it's working for the simple use cases I gave here and in the real project from which I discover this change in the first place. |
I can confirm this regression when using on Linux (w/ Bash) and Windows (w/ PowerShell 7):
$ cat .env
TAG=v1.5
$ cat docker-compose.yml
version: '2'
services:
web:
image: "webapp:${TAG}"
$ docker compose config
name: docker-env
services:
web:
image: webapp:v1.5
networks:
default: null
networks:
default:
name: docker-env_default
$ export TAG=XXX
$ docker compose config
name: docker-env
services:
web:
image: webapp:v1.5
networks:
default: null
networks:
default:
name: docker-env_default whereas I expected FWIW, https://docs.docker.com/compose/environment-variables/ explains that
|
Fixed on |
And the regression is live again in 2.8.0. |
BUG REPORT INFORMATION
Description
From the documentation:
This is no longer true since the
2.5.1
release.Steps to reproduce the issue:
docker-compose.yaml
file with:.env
file with:MY_VAR=shell docker compose run alpine printenv MY_VAR
Describe the results you received:
Current output:
file
Describe the results you expected:
Expected output:
shell
Additional information you deem important (e.g. issue happens only occasionally):
Works on Docker Compose
2.5.0
.Output of
docker compose version
:Output of
docker version
:Output of
docker info
Additional environment details:
The text was updated successfully, but these errors were encountered: