0
votes

I'm unable to run the Docker Compose task on Azure DevOps and every solution I've looked up online, either makes no sense, or does not work for my scenario.

The job output for the failure is:

enter image description here

This is a very simple process, artifacts are copied to a folder during build, and the docker-compose.yml and .dockerfile is added to this directory, which then needs to be run.

One article explained that if you add your docker-compose.yml to the same folder as the files the image will be hosting and the .dockerfile, that it might cause the daemon to fall over and generate this generic error, so I've added a .dockerignore file, but this issues persists.

I'm using a Hosted Agent - Ubuntu-18.04.

My task looks like this:

steps:
- task: DockerCompose@0
  displayName: 'Run a Docker Compose command'
  inputs:
    azureSubscription: 'Test Dev Ops'
    azureContainerRegistry: '{"loginServer":"testdevops.azurecr.io", "id" : "/subscriptions/{subscription_key}/resourceGroups/Test.Devops/providers/Microsoft.ContainerRegistry/registries/testdevops"}'
    dockerComposeFile: '$(System.DefaultWorkingDirectory)/$(Release.PrimaryArtifactSourceAlias)/test.ng.$(Build.BuildNumber)/dist/testweb/docker-compose-build.yml'
    dockerComposeCommand: build
    arguments: '--build-arg azure_pat=$(System.AccessToken) --build-arg azure_username=Azure'

The idea here is that this container is composed and delivered straight to Azure's Container Registry.

I have ensured that the user that's running this process, as been granted permissions in that ACR, as well as added the user to the Administrative group in Azure DevOps.

A lot of responses talks about adding the user to the Docker group, but this is a Hosted Agent, not a private agent, so there is no such option.

I have even tried installing Docker CLI before this task, but nothings working.

Am I being daft to think that I can compose in Azure DevOps?

Edit

The contents of my artifacts folder looks something like this:

enter image description here

1
Can you run the docker-compose command to build your project successfully on your local machine? You can have a try running the dock-compose command and adding user to the "docker" group in a Bash task using inline scripts.Levi Lu-MSFT
@LeviLu-MSFT i answerd my own question. turned out to be a missing semi-colon in a build task prior to the release, which resulted in the yml file to be dirty, thus the compose task failing. very misleading error.?JadedEric

1 Answers

0
votes

This error message is extremely misleading. If anyone from Microsoft is looking at this question, please consider making the error more specific, if possible.

It turned out, I missed a semi-colon in a build task that replaced tokens before the build artifacts was pushed from the build output, and because of that, the yaml file had a #{..} token inside of it, which caused the docker-compose to fail.

It had nothing to do with permissions, nor a .dockerignore file, very misleading.