Michele
Michele

Reputation: 349

Azure Devops self-hosted agent with docker

I have installed an Azure self hosted agent (Linux) and am following the documentation from https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/docker?view=azure-devops.

I have succeeded in installing the agent however when I run a Docker Build task which compiles and builds a docker image I am getting an error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

After googling the issue it seems the code below should mount the docker.sock and I should be able to build and push docker images successfully, however this did not work on AKS

        volumeMounts:
        - mountPath: /var/run/docker.sock
          name: docker-volume
      volumes:
      - name: docker-volume
        hostPath:
          path: /var/run/docker.sock

Has anyone encountered any such issue? I am building using AzureDevops Docker@2 task and agent is running on AKS 1.19.11

Upvotes: 4

Views: 6194

Answers (1)

silent
silent

Reputation: 16198

Since AKS 1.19 it uses containerd as the container runtime - which means that you cannot directly build docker images inside AKS anymore. See this article for details and possible workarounds.

In general, I find VMSS-based self-hosted Agents for Azure DevOps a great alternative to container-based agents.

Upvotes: 1

Related Questions