-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Docker Compose V2 config command does not include version tag in the output #8796
Comments
This is important as the output fails to be usable for
Lack of version tag makes parser default it to 1.0, which is unsuitable for Docker Swarm. |
|
@ndeloof Looks like others have also encountered this in the past based on: https://stackoverflow.com/questions/57406409/unsupported-compose-file-version-1-0-even-when-i-have-the-right-compatability I'm not understanding the proposed solution that this issue was closed in favour of.. If its not possible to include this version tag in the output any longer by default, then perhaps a new arg could be added to the |
we can't force a version header, as there's no version we can use here: this is not |
My use case was that different yaml files were written in different versions (some are version 2) and |
docker-compose v1 did not supported merging compose file with distinct version (see compose/compose/config/config.py Line 344 in 9f2fd6f
|
Even after manually appending the version header myself, stack deploy hit another error
Looking at the output, compose outputs the published ports as strings now:
Despite them being specified as However to come back to your question: When running Are you saying |
Note: others have discussed this here: https://stackoverflow.com/questions/58666953/how-can-i-pass-the-variables-i-have-placed-in-the-env-file-to-the-containers-in#:~:text=Loading%20the.env%20file%20is%20a%20feature%20of%20docker-compose,set%20%2Ba%20docker%20stack%20deploy%20-c%20docker-compose.yml%20stack_name Note: We opted to use the Another option proposed there is to load the .env file into the shell prior to doing docker stack deploy with something like this:
However |
@ndeloof you made me doubt, so I double checked and it works for me; it keeps version from the first file in the chain:
|
Ok I have found a workaround to replace the reliance on In my powershell script I now do the following to set environment variables from the .env file myself $envFileContent = Get-Content -Path $envFileName
ForEach ($line in $envFileContent)
{
if($line)
{
$varNameValSplit = $line.Split("=")
if($varNameValSplit.Length -eq 2)
{
$varName = $varNameValSplit[0]
$varVal = $varNameValSplit[1]
[Environment]::SetEnvironmentVariable($varName, $varVal)
Write-Output "Set var $varName"
}
}
}
docker stack deploy -c $composeFileName --with-registry-auth $stackName |
@dazinator So if I understand this correctly, you still use the docker-compose file with the interleaved environment variables (e.g. I'm facing the same, annoying, unnecessary, chain of problems with different docker components you did, and would really like to confirm this simple solution works. |
Yes, setting the environment variables in the same process that runs the docker stack deploy command worked for me (in my case pwsh) |
Docker Compose V2 config command does not include version tag in the output
Steps to reproduce the issue:
Describe the results you received:
Output produced does not include the version: tag so Docker defaults to config v1 and fails
Describe the results you expected:
Output should include the version: tag from the compose file
Additional information you deem important (e.g. issue happens only occasionally):
Works as expected with version 1.29.2
Output of
docker compose version
:Output of
docker info
:Additional environment details:
The text was updated successfully, but these errors were encountered: