With AzureDevOps I get the following error since yesterday, before that everything worked fine for months:
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.
In Azure-DevOps I use in the pipeline:
- task: DockerCompose@0
displayName: Run services
inputs:
containerregistrytype: 'Container Registry'
dockerComposeFile: 'build/docker/docker-compose.yml'
dockerComposeFileArgs: 'DOCKER_BUILD_SOURCE=$(System.DefaultWorkingDirectory)'
action: 'Run services'
buildImages: false
My docker-compose (docker-compose.yml) file looks like this (details changed):
version: '3.0'
services:
sqlserver:
image: willh/mssql-server-windows-developer:latest
container_name: sqlserver
shm_size: 4gb
ports:
- "1433:1433"
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=a(!)Passcode
I realized the updated microsoft build agent Image:
from: https://github.com/actions/runner-images/blob/win22/20230129.1/images/win/Windows2022-Readme.md
which worked well
containing:
- Docker 20.10.23
- Docker Compose v1 1.29.2
- Docker Compose v2 2.15.1
- Docker-wincred 0.7.0
to: https://github.com/actions/runner-images/blob/win22/20230206.1/images/win/Windows2022-Readme.md
which does not work
containing:
- Docker 23.0.0
- Docker Compose v1 1.29.2
- Docker Compose v2 2.15.1
- Docker-wincred 0.7.0
But i do not see how I can get it to work again.
Which COMPOSE_API_VERSION would I have to set? The same as I have in the docker-compose.yml file?
2
Answers
The following solved the problem as a workaround:
Important was to set the projectName as well as the dockerComposePath.
See discussions in:
Hopefully this will be fixed in:
The error message you are receiving indicates that the version of Docker Compose being used is not compatible with the version specified in your Docker Compose file (docker-compose.yml). The version specified in your Docker Compose file is 3.0, but the version of Docker Compose installed on the updated build agent image is 2.15.1.
To resolve this issue, you can either upgrade the Docker Compose file to a version that is compatible with the installed version of Docker Compose, or you can set the COMPOSE_API_VERSION environment variable to the version specified in the Docker Compose file.
In your case, you could set the COMPOSE_API_VERSION environment variable to 3.0:
and add this environment variable to the Azure DevOps pipeline task:
This should allow the pipeline task to use the correct version of Docker Compose and avoid the compatibility error.