-
Notifications
You must be signed in to change notification settings - Fork 254
Docker v2 Beta can't handle env file without "=" after variable name #1917
Comments
This workaround with adding
|
Because of this docker-compose and docker different behaviour this is a major issue. |
The apache#16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2.
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2.
Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917
need to check how https://pypi.org/project/python-dotenv/ and https://github.com/joho/godotenv differ for this specific syntax, and propose a fix |
python-dotenv explicitely consider lack of an equal sign as "value: none" ruby's dotenv parser don't declare the equal sign as optional Based on this I'm not sure godotenv would accept a PR to ignore a missing separator? I also need to tell I don't really understand how usefull |
This is all about passing variables to INSIDE the container, not compose variables. |
We heavily rely on it in Apache Airflow: https://github.com/apache/airflow/blob/main/scripts/ci/docker-compose/_docker.env We alse have some scenarios (mostly CI-based) when we use the same airflow image and run a specific command - but we do not need docker compose for that as we only need to spin that single image. In the first case our docker-compose has this: In the second case we pass the same env file to a All those are based on values already set by previous steps in the script (based on the user flags) or environment variables set in CI For example here is how they are set from user input: https://github.com/apache/airflow/blob/1960e37952efc08ad33328ff511a846f2376ad4f/breeze#L792 And here we set a number of those env vars in CI: https://github.com/apache/airflow/blob/1960e37952efc08ad33328ff511a846f2376ad4f/.github/workflows/ci.yml#L31 |
For now I had to actually warn the users to disable v2 :( until the problem is solved: https://github.com/apache/airflow/blob/1960e37952efc08ad33328ff511a846f2376ad4f/breeze#L594 Happy to help testing it when it is fixed :) |
not very pleasant, but a possible short term workaround is to use |
Not sure if that would work for docker case, but yeah. Worth checking! thanks for the suggestion. |
Yep. works in both cases! Thanks for the suggestion @ndeloof - I will workaround it this way for now! UPDATE: I must have been doing something wrong. The workaround does not work with docker's --env-file :( |
Easy fix: |
fixing joho/godotenv won't be trivial, as we can't just consider |
That's correct. That's how it worked so far |
BTW. I am fine with Airflow with using FOO=${FOO} because I deliberately made a choice of not relying on variable being set/unset but on its value. So even binary variables for me have "true"/"false" value and check is != "true" - precisely for the reason. |
The docker-compose v2 parsing of env file bug detected in apache#16949 and eventual disabling of docker-compose-v2 in apache#16989 found another workaround after discussing with docker-compose maintainers in docker-archive/compose-cli#1917 The VAR=${VAR} pattern seems to work for all cases for Airflow because we never rely on the fact if variable is set or not - we always take into account value of the variable (that is by design and strictly followed everywhere). Therefore we are sure this workaround is going to work for us. However we should remove that workaround once the bug is fixed in Docker-Compose V2.
Actualy I just double-checked and tried it again and it DOES NOT work in docker :(. So it should be fixed. The error here https://github.com/apache/airflow/pull/17052/checks?check_run_id=3087380066 was caused by PACKAGE_FORMAT got the "unexpected" value of "${PACKAGE_FORMAT}". Since PACKAGE_FORMAT value is set in that step to "wheel", the only explanation I find is that the the docker used does not resolve those values as env variables (and actually docker documentation does not even mention that it can do it). I just double-checked it and well... yeah:
|
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround)
Seems that we have very similar issues for Linux v2 just released |
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround)
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. (cherry picked from commit 72781c0b4548d35a37fbbef9c2417f94d2025f8f) GitOrigin-RevId: 373007b28f543d7c4e7537c7b8be4d5916346ccd
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 (cherry picked from commit 97ae0f2bf36033a69e6221b569d063f856491571) GitOrigin-RevId: 5f3b53f2e8e79bd109effdb56cedabbf9aec9486
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. GitOrigin-RevId: 72781c0b4548d35a37fbbef9c2417f94d2025f8f
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 GitOrigin-RevId: 97ae0f2bf36033a69e6221b569d063f856491571
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround) GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. GitOrigin-RevId: 72781c0b4548d35a37fbbef9c2417f94d2025f8f
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 GitOrigin-RevId: 97ae0f2bf36033a69e6221b569d063f856491571
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround) GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. GitOrigin-RevId: 72781c0b4548d35a37fbbef9c2417f94d2025f8f
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 GitOrigin-RevId: 97ae0f2bf36033a69e6221b569d063f856491571
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround) GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. GitOrigin-RevId: 72781c0b4548d35a37fbbef9c2417f94d2025f8f
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 GitOrigin-RevId: 97ae0f2bf36033a69e6221b569d063f856491571
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround) GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. GitOrigin-RevId: 72781c0b4548d35a37fbbef9c2417f94d2025f8f
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 GitOrigin-RevId: 97ae0f2bf36033a69e6221b569d063f856491571
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround) GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. GitOrigin-RevId: 72781c0b4548d35a37fbbef9c2417f94d2025f8f
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 GitOrigin-RevId: 97ae0f2bf36033a69e6221b569d063f856491571
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround) GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. GitOrigin-RevId: 72781c0b4548d35a37fbbef9c2417f94d2025f8f
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 GitOrigin-RevId: 97ae0f2bf36033a69e6221b569d063f856491571
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround) GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
The #16950 aimed to fix an incompatibility introduced by beta version of docker-compose v2 (which is automatically pushed to MacOS users now). The issue is documented in docker-archive/compose-cli#1917 Unfortunately it has an undesired side-effect that the same file cannot be used to specify list of variables for docker command (the variables come empty). Until the problem is solved, we need to keep two copies of those variable files. Not ideal, but hopefully the issue will be solved soon and we can go back to original env file in docker-compose v2. GitOrigin-RevId: 72781c0b4548d35a37fbbef9c2417f94d2025f8f
…16989) Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see docker-archive/compose-cli#1917 GitOrigin-RevId: 97ae0f2bf36033a69e6221b569d063f856491571
Docker-compose 2 on linux introduced a number of problems and incompatibilities: * version is printed in different format * -f flag was failing after --log-level info was passed * environment variables were not correctly passed with _docker.env with missing values All those worked fine in 1.29.2 and even in MacOS version of docker-compose 2 (after raising and fixing some bugs by us docker-archive/compose-cli#1917 This PR: * fixes version regexp * removes --log-level info * adds copy of _docker.env with var="${var} assignments specifically for docker-compose (duplicated variables but this works as a workaround) GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
Description
When you specify --env-file filename.env for the new docker-compose and the env file contains just variable names without "=" afterwards, the docker-compose command fails with "Can't separate key from value"
Steps to reproduce the issue:
_docker.env
file with this content in a directory where you have a docker-compose file:docker-compose up --env-file ${PATH}/_docker.env
Describe the results you received:
The command fails with
Can't separate key from value
errorDescribe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
Seems that adding
=
after the variable fixes the problem:This issue was first discovered in apache/airflow#16949 and workarounded in apache/airflow#16950 by @oyarushe for Apache Airflow.
**Output of
docker-compose --version
: ***Output of
docker version
:The text was updated successfully, but these errors were encountered: