Skip to content
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

DockerCompose@0 uses outdated Docker-Compose utility 1.29.2 #17808

Open
SillyCode opened this issue Feb 23, 2023 · 6 comments
Open

DockerCompose@0 uses outdated Docker-Compose utility 1.29.2 #17808

SillyCode opened this issue Feb 23, 2023 · 6 comments

Comments

@SillyCode
Copy link

SillyCode commented Feb 23, 2023

Since the update to Docker Engine and using the latest Windows-2019 image release 20230214.1.
(The image contains the following Docker related versions: Docker 23.0.1 and Docker Compose V2 2.16.0)

And having the following task

- task: DockerCompose@0
      displayName: Spin up container
      inputs:
        containerregistrytype: 'Container Registry'
        dockerRegistryEndpoint: 'Schema-BuildReg'
        dockerComposeFile: 'Sources/Tests/Docker/docker-compose.yml'
        action: 'Run a Docker Compose command'
        dockerComposeCommand: 'up'
        arguments: '-d'

We are facing the following error:
The current Compose file version is not compatible with your engine version. Please upgrade your Compose file to a more recent version, or set a COMPOSE_API_VERSION in your environment.

My Docker-Compose file:

version: "3.9"
services:
  sql-server-db:
    container_name: my-mssql
    image: my-mssql-image:latest
    ports:
      - "1433:1433"
    environment:
      SA_PASSWORD: "***************"
      ACCEPT_EULA: "Y"

Error log:

2023-02-19T08:22:09.0368683Z ##[debug]which 'docker-compose'
2023-02-19T08:22:09.0752496Z ##[debug]found: 'C:\ProgramData\Chocolatey\bin\docker-compose.exe'
2023-02-19T08:22:10.3052706Z [command]C:\ProgramData\Chocolatey\bin\docker-compose.exe -f D:\a\1\s\Sources\Tests\Docker\docker-compose.yml -f C:\agents\2.217.2\.docker-compose.1676794930282.yml -p SI up -d
2023-02-19T08:22:11.4679494Z Creating network "si_default" with the default driver
2023-02-19T08:22:12.0324536Z Pulling sql-server-db (***/my-mssql-image:latest)...
2023-02-19T08:22:14.8209567Z I2: Pulling from [i2-si-mssql](my-mssql-image:latest)
2023-02-19T08:32:54.0137344Z The current Compose file version is not compatible with your engine version. Please upgrade your Compose file to a more recent version, or set a COMPOSE_API_VERSION in your environment.
2023-02-19T08:32:54.9175774Z ##[debug]Exit code 1 received from tool 'C:\ProgramData\Chocolatey\bin\docker-compose.exe'
2023-02-19T08:32:54.9177252Z ##[debug]STDIO streams have closed for tool 'C:\ProgramData\Chocolatey\bin\docker-compose.exe'
2023-02-19T08:32:55.0020263Z ##[error]Pulling sql-server-db (***/my-mssql-image:latest)...
2023-02-19T08:32:55.0021455Z ##[debug]Processed: ##vso[task.issue type=error;]Pulling sql-server-db (***/my-mssql-image:latest)...
2023-02-19T08:32:55.0023243Z ##[error]The current Compose file version is not compatible with your engine version. Please upgrade your Compose file to a more recent version, or set a COMPOSE_API_VERSION in your environment.
2023-02-19T08:32:55.0025902Z ##[debug]Processed: ##vso[task.issue type=error;]The current Compose file version is not compatible with your engine version. Please upgrade your Compose file to a more recent version, or set a COMPOSE_API_VERSION in your environment.
2023-02-19T08:32:55.0117852Z ##[debug]task result: Failed
2023-02-19T08:32:55.0119880Z ##[error]The process 'C:\ProgramData\Chocolatey\bin\docker-compose.exe' failed with exit code 1

Specifically the line
##[error]The process 'C:\ProgramData\Chocolatey\bin\docker-compose.exe' failed with exit code 1

Looking at the build log. We can see that the issue is reported actually by Choco Docker Compose.

DockerCompose@0 uses Docker Compose version from C:\ProgramData\Chocolatey\bin\
Instead, it should take the latest Docker-Compose utility.

Going ahead to get the version of the Choco Docker Compose via:

- task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          C:\ProgramData\Chocolatey\bin\docker-compose.exe version

Outputted the following:

docker-compose version 1.29.2, build 5becea4c

Choco Docker Compose for reference:
https://community.chocolatey.org/packages/docker-compose

As a workaround, I used below suggested solution

- task: PowerShell@2
      displayName: Run Docker-Compose
      inputs:
        targetType: 'inline'
        script: C:\ProgramData\docker\cli-plugins\docker-compose.exe -f docker-compose.yml up -d
@lamelyan
Copy link

lamelyan commented Mar 14, 2023

I'm using the next version V2 of Docker Compose which uses the docker CLI 'compose' command instead of the docker-compose executable.

The task is looking for the 'docker-compose' executable and gives me an error.

Docker Compose was not found. You can provide the path to docker-compose via 'dockerComposePath'

@shrralis
Copy link

shrralis commented Aug 8, 2023

I've found a workaround for this.
Add a new Bash task to download the latest Docker Compose:

wget -Odocker-compose https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64

chmod a+x ./docker-compose

In my Docker Compose task (0.*) under the Advanced Options -> Docker Compose executable Path set the $(System.DefaultWorkingDirectory)/docker-compose

@walkindude
Copy link

walkindude commented Oct 10, 2023

@shrralis thanks for sharing your workaround, you just saved my tail.

The task should be fixed to try docker compose if docker-compose fails though, as I just took a look at the source and it does exactly a which docker-compose, which of course won't work with recent versions of Docker.

@nibdev
Copy link

nibdev commented Oct 26, 2023

Here's another workaround (if you have Compose V2 as cli plugin).
Specifiy the path to docker-compose as task parameter

grafik

@ashishbhatt-afk
Copy link

Here's another workaround (if you have Compose V2 as cli plugin). Specifiy the path to docker-compose as task parameter

grafik

Thank you for the workaround. But is there a permanent solution that we can expect in near future?

@yuriy-sng
Copy link

yuriy-sng commented Jun 21, 2024

Workaround also helped with this error which appeared today to me:

##[debug]arguments:
##[debug] compose
##[debug] --compatibility
##[debug] -f
##[debug] /agent/_work/1/s/docker-compose.ci.yaml
##[debug] -p
##[debug] MyProject
##[debug] config

##[error]unknown flag: --compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants