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

docker-compose vs. docker compose #17051

Open
gimlichael opened this issue Oct 15, 2022 · 8 comments
Open

docker-compose vs. docker compose #17051

gimlichael opened this issue Oct 15, 2022 · 8 comments

Comments

@gimlichael
Copy link

I looked through the code after I experience some issues on Azure Virtual Machine Scale Set; it looks like this DockerCompose@0 need a much needed upgrade to V2+: https://docs.docker.com/compose/compose-file/compose-versioning/

docker-compose is deprecated; docker compose is the "new" syntax.

Please consider a DockerCompose@2 using docker compose command instead of docker-compose.

https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/DockerComposeV0/dockercomposeconnection.ts

Its probably not as simple as changing this: this.dockerComposePath = tl.which("docker-compose"); to this.dockerComposePath = tl.which("docker compose");.

    private setDockerComposePath(): void {
        //Priority to docker-compose path provided by user
        this.dockerComposePath = tl.getInput('dockerComposePath');
        if (!this.dockerComposePath) {
            //If not use the docker-compose avilable on agent
            this.dockerComposePath = tl.which("docker-compose");
            if (!this.dockerComposePath) {
                throw new Error("Docker Compose was not found. You can provide the path to docker-compose via 'dockerComposePath' ");
            }
        } else {
            console.log("Using docker-compose from 'dockerComposePath' ");
        }
    }
@Strayfe
Copy link

Strayfe commented Nov 2, 2022

This is affecting us too.

We need to be able to use BuildKit which is now the default in docker compose v2+ and the variable DOCKER_BUILDKIT: 1 does not appear to be working correctly in the current version of DockerCompose@0.

For now, the workaround my colleague Joe 'big'ol brass nuts' de Ronde has created is to:

  • use a self-hosted build agent
  • create an alias file /bin/docker-compose that contains docker compose "$@"
  • set the docker task variable `dockerComposePath: '/bin/docker-compose'
- task: DockerCompose@0
    displayName: docker compose build
    inputs:
      dockerComposePath: '/bin/docker-compose'

We did try setting an alias in ~/.bashrc first but this did not return the desired results.

The inspiration for this workaround: https://stackoverflow.com/questions/72099653/how-to-alias-docker-compose-to-docker-compose

@gimlichael
Copy link
Author

gimlichael commented Nov 2, 2022

This is affecting us too.

We need to be able to use BuildKit which is now the default in docker compose v2+ and the variable DOCKER_BUILDKIT: 1 does not appear to be working correctly in the current version of DockerCompose@0.

For now, the workaround my colleague Joe 'big'ol brass nuts' de Ronde has created is to:

  • use a self-hosted build agent
  • create an alias file /bin/docker-compose that contains docker compose "$@"
  • set the docker task variable `dockerComposePath: '/bin/docker-compose'
- task: DockerCompose@0
    displayName: docker compose build
    inputs:
      dockerComposePath: '/bin/docker-compose'

We did try setting an alias in ~/.bashrc first but this did not return the desired results.

The inspiration for this workaround: https://stackoverflow.com/questions/72099653/how-to-alias-docker-compose-to-docker-compose

Nice workaround; however, I need to be able to switch between managed and VMSS for my pipeline, so I opt-in for adding a custom script to the "Extensions + applications" blade:

sudo apt-get update
sudo apt-get install docker-compose-plugin
sudo apt-get  -y install docker-compose

Not pretty, but at least it is compatible with that old version.

@janosroden
Copy link

You can also use the docker task with "login" command and then just call docker compose as usual from a script.

@github-actions
Copy link

github-actions bot commented Jun 7, 2023

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Jun 7, 2023
@kurt-mueller-osumc
Copy link

Let's keep this issue alive... can't we get at least a version 1 of this task with the latest docker compose?

@github-actions github-actions bot removed the stale label Jun 8, 2023
@Mahdibenamor
Copy link

Any update about this issue, it blocks us

@GuidDotEmpty
Copy link

please fix this

@benlings
Copy link

benlings commented Apr 2, 2024

The latest runner images since 1st April 2024 remove docker-compose, so any hosted pipeline in Azure DevOps that uses DockerCompose@0 will fail with the error Unhandled: Docker Compose was not found.

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