VSTS docker 代理 运行 另一个容器内的任务退出,错误代码为 127

VSTS docker agent running a task inside another container exits with error code 127

我 运行 docker 容器内的私有 vsts 代理

docker run -e VSTS_ACCOUNT=<vstsaccount> -e VSTS_TOKEN=<vstspat> -e 
VSTS_WORK=/var/vsts -v /var/run/docker.sock:/var/run/docker.sock  
-v D:/dockertestmount:/var/vsts 
-d microsoft/vsts-agent:ubuntu-16.04-docker-17.03.0-ce-standard

通过调用此 docker 命令,我在 vsts 在线代理队列中看到代理注册成功。

我正在尝试使用此预览功能从此 vsts 代理(在本例中它本身就是一个 docker 容器)在 docker 容器内启动任务

https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/runtaskindocker.md

这意味着 docker vsts 代理容器将监听构建请求,当有构建请求时,它将在另一个 docker 容器中启动任务。

我试图在构建定义中使用的 yaml 文件是:

phases:
- phase: consoleappbuild
  variables:
    _PREVIEW_VSTS_DOCKER_IMAGE: "microsoft/dotnet-nightly"
  queue: Default
  steps:
  - bash: |
        cd ConsoleApp1
        dotnet restore
        dotnet build

使用这个 vsts yaml 文件,我看到 vsts docker 代理启动了一个新容器来构建。

源也已下载到新任务 docker 容器中。

但是在构建期间任务容器突然退出并出现错误代码:

 2018-02-13T19:10:21.7956034Z bash: line 0: cd: /var/vsts/2/s: No such file or directory
 2018-02-13T19:10:21.7981864Z bash: /vsts/agent/externals/node/bin/node: No such file or 
 directory
 [error]Exit code 127 returned from process: file name
 [error]Exit code 127 returned from process: file name
    '/usr/local/bin/docker', arguments 'exec -u 0  -e "INPUT_TARGETTYPE=inline" 
    -e "INPUT_FILEPATH=/var/vsts/1/s" -e "INPUT_ARGUMENTS=" -e 
    "INPUT_SCRIPT=cd ConsoleApp1 ----

这个控制流程出错的原因是什么?

似乎问题出在卷安装上。任务容器无法使用装载的卷。

我检查了日志,任务容器是在 /var/vsts/1/s 上安装卷创建的,并且 /var/agent/externals

我在 vsts-agent github 问题列表上得到了我的问题的答案 GithubIssueWithAnswer

似乎在 docker 容器中启动任务的预览功能在 windows 上不起作用。另请注意,我已验证预览功能在 linux 基本内核上工作正常。 –