Add support to use --env-file for docker compose up #1152
Comments
Support for but |
related: compose-spec/compose-go#97 |
@ndeloof it's strange, but PS: values doesn't provided into |
Docker Desktop 3.1.0 indeed includes compose-cli "Cloud integration" 1.0.7 I have the same installed. services:
test:
image: alpine
command: echo hello ${FOO} and .env file:
and get the expected result: ➜ docker compose up
The new 'docker compose' command is currently experimental. To provide feedback or request new features please open issues at https://github.com/docker/compose-cli
[+] Running 2/2
⠿ Network "test_default" Created 0.1s
⠿ test_test_1 Created 0.0s
Attaching to test_test_1
test_test_1 | hello 1000 |
fixes docker#1152 Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
fixes docker#1152 Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
pls reopen, because I think there's bug with dotenv: for example:
dotenv file:
docker-compose file:
Running your example:
and see what I have with
|
As I can see if copying dotenv into
dotenv from docker folder
it's not same behaviour 😕 |
Problem is here
|
thanks for digging into this, will look further tomorrow |
Doing some experiments I noticed this behaviour changed in docker-compose 1.28 as docker/compose#7965 |
As I understand, they decided to save old behavior. |
Latest versions 1.24-1.27 had this behavior and load .env file from folder, where it (docker-compose) was started. |
I tend to agree, but then this has to be documented and debated on docker/compose#7928. |
closing in the meantime, as "work as expected" regarding the current status of docker-compose 1.28 |
this bug should be reopened
Works ok , however when use -d flag throws warning in docker compose logs , and when i digged into env variables is not being passed
WARN[0000] The "MYSQL_VERSION" variable is not set. Defaulting to a blank string. workaround this issue is to run docker-compose instead of using docker compose command
docker-compose version 1.29.2, build 5becea4c
Client: Server Version: 20.10.12
Client: Server: Docker Desktop 4.5.0 (74594) |
@laithrafid Compose v2 is now hosted on https://github.com/docker/compose, please use this repo if you want to report a bug. There's no |
It currently lacks support for --env-file flag, to load env vars form a file and automatically load env variables from
.env
like it doesdocker-compose
.The text was updated successfully, but these errors were encountered: