简体   繁体   English

从 Azure 管道任务构建一个 docker 图像

[英]Build a docker image from Azure Pipeline Task

In the folliwing documentation https://learn.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops在以下文档中 https://learn.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops

it is mentioned that - "Be sure your pipelines agent has permission to access the Docker daemon."提到 - “确保您的管道代理有权访问 Docker 守护程序。” How to check it, configure it and provide the permission if necessary如何检查它,配置它并在必要时提供权限

I get the following error while building a docker image on a VM machine with docker installed on it:在安装了 docker 的虚拟机上构建 docker 映像时出现以下错误:

open //./pipe/docker_engine: Access is denied. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

Already checked that the docker daemon is running with the following command:已经使用以下命令检查 docker 守护进程是否正在运行:

docker --version 

And I can see the docker version我可以看到 docker 版本

Docker version 19.03.5, build 2ee0c57608

Verify that services using System account.使用系统帐户验证服务。 The service is created when configuring the agent该服务是在配置代理时创建的

Screen for the configuration配置屏幕

It is mentioned that - "Be sure your pipelines agent has permission to access the Docker daemon."提到 - “确保您的管道代理有权访问 Docker 守护程序。” How to check it, configure it and provide the permission if necessary.如何检查、配置它并在必要时提供权限。

It's the user which run the agent .运行代理的用户 You need to make sure that user have enough permission.您需要确保用户具有足够的权限。 Or you could switch your agent to run as the same user which docker daemon is running as.或者,您可以将代理切换为以 docker 守护程序运行的同一用户身份运行。

More details about the error you could also kindly refer this similar issue: container jobs fails to connect to docker daemon on Windows Server 2019有关错误的更多详细信息,您也可以参考此类似问题: 容器作业无法连接到 Windows Server 2019 上的 docker 守护进程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM