0
votes

I run a private vsts agent inside a docker container

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

With the invocation of this docker command, I see a successful agent registration inside vsts online agent queue.

I am trying to use this preview feature to start a task inside a docker container from this vsts agent (which itself is a docker container in this case)

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

That means the docker vsts agent container will listen for build requests and when there is one, it will start a task in another docker container.

The yaml file I am trying to use in the build definition is:

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

With the usage of this vsts yaml file, I see that a new container gets launched by the vsts docker agent to build.

The sources were downloaded as well in the the new task docker container.

But during build the task container exits abruptly with the error code:

 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 ----

What is the cause of error in this control flow ?

seems like the issue is with volume mounting. The task container is unable to use the mounted volume.

I have checked the logs and the task container was created with volume mounting on /var/vsts/1/s and /var/agent/externals

1
Got an answer on the issue listVarunkumar Manohar
Seems like the preview feature for launching a a task inside docker containers does not work on windows. Also to note,I have verified that the preview feature works fine on linux base kernel.Varunkumar Manohar

1 Answers

0
votes

I got an answer to my question on vsts-agent github issues list GithubIssueWithAnswer

Seems like the preview feature for launching a a task inside docker containers does not work on windows. Also to note,I have verified that the preview feature works fine on linux base kernel. –