title: VSTS docker agent running a task inside another container exits with error code 127
body: <p>I run a private vsts agent inside a docker container</p>
  
  <pre><code>docker run -e VSTS_ACCOUNT=&lt;vstsaccount&gt; -e VSTS_TOKEN=&lt;vstspat&gt; -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
  </code></pre>
  
  <p>With the invocation of this docker command, I see a successful agent registration inside vsts online agent queue.</p>
  
  <p>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)</p>
  
  <p><a href="https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/runtaskindocker.md" rel="nofollow noreferrer">https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/runtaskindocker.md</a></p>
  
  <p>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.</p>
  
  <p>The yaml file I am trying to use in the build definition is:</p>
  
  <pre><code>phases:
  - phase: consoleappbuild
    variables:
      _PREVIEW_VSTS_DOCKER_IMAGE: "microsoft/dotnet-nightly"
    queue: Default
    steps:
    - bash: |
          cd ConsoleApp1
          dotnet restore
          dotnet build
  </code></pre>
  
  <p>With the usage of this vsts yaml file, I see that a new container gets launched by the vsts docker agent to build.</p>
  
  <p>The sources were downloaded as well in the the new task docker container.</p>
  
  <p>But during build the task container exits abruptly with the error code:</p>
  
  <pre><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 ----
  </code></pre>
  
  <p>What is the cause of error in this control flow ?</p>
  
  <p>seems like the issue is with volume mounting. The task container is unable to use the mounted volume.</p>
  
  <p>I have checked the logs and the task container was created with volume mounting on /var/vsts/1/s and
  /var/agent/externals</p>