【问题标题】:How to run docker on self hosted Azure agent as non root ? (agent is locked by MS to run as root)如何在自托管 Azure 代理上以非 root 身份运行 docker? (代理被 MS 锁定为 root 运行)
【发布时间】:2020-06-04 12:39:15
【问题描述】:

由于您无法以 root 身份安装代理,并且 docker 需要 root 才能运行命令,所以如何使用自托管 Azure 构建代理?

我已按照代理要求将代理安装为非 root,并将 docker 安装为 root。

用于运行代理的用户无法访问 docker ;/

【问题讨论】:

    标签: docker azure-devops


    【解决方案1】:

    检查以下链接:

    https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/docker?view=azure-devops

    您可以设置 Azure Pipelines 自托管代理以在带有 Docker 的 Windows Server Core(适用于 Windows 主机)或 Ubuntu 容器(适用于 Linux 主机)中运行。您将传递一些 environment variablesdocker run,它们将代理配置为连接到 Azure Pipelines 或 Azure DevOps 服务器。例如:

    docker run -e AZP_URL=<Azure DevOps instance> -e AZP_TOKEN=<PAT token> -e AZP_AGENT_NAME=mydockeragent dockeragent:latest
    

    【讨论】:

    • 由于某些构建代理的某些限制,我不希望运行基于 docker 的构建代理。我在问这是否可以在这个特定的用例中运行。我知道我可以运行 docker build agent。
    • 如何创建 docker 组并将您的用户添加为this documentation 提到的? - 容器:ubuntu 映像:ubuntu:16.04 选项:'--group-add docker' (github.com/microsoft/azure-pipelines-agent/issues/…)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-24
    • 2015-01-04
    相关资源
    最近更新 更多