0

I created an Azure DevOps agents based on the Ubuntu image that can be found here: https://github.com/Microsoft/azure-pipelines-image-generation

After I deployed the machine and installed the agent (see https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-linux?view=vsts) I ran a Docker task and got the following error:

dial unix /var/run/docker.sock: connect: permission denied

What do I have to do to get the Docker task executed successfully?

quervernetzt
  • 10,311
  • 6
  • 32
  • 51

1 Answers1

1

The problem is that the agent service has not the permissions to connect. You can either run the agent service as root (sudo ./svc.sh install root) what I would not recommend or add the user to the Docker group via sudo usermod -a -G docker $USER.

Then logout and and log in again and it should work.

See also https://docs.docker.com/install/linux/linux-postinstall/

quervernetzt
  • 10,311
  • 6
  • 32
  • 51
  • (But remember that anyone who can run any `docker` command can trivially get root on the system; guarding it behind `sudo` is not wrong.) – David Maze Nov 28 '18 at 11:03