Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51443

Wrong mount point spec for Windows Containers in Docker

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None

      It seems that ":z" volume bind mount flag in docker is not suported for windows containers.

      For jenkinsfile:

      pipeline {
          agent {
              docker { image 'mksondej/aspnet-node-msbuild' }
          }
          stages {
              stage('Test') {
                  steps {
                      powershell 'ls'
                  }
              }
          }
      }

      Here's what my pipeline tries to execute:

       

      docker run -t -d -u 18:18 -w "C:\Program Files (x86)\Jenkins\workspace\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA" -v "C:\Program Files (x86)\Jenkins\workspace\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA:C:\Program Files (x86)\Jenkins\workspace\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA:rw,z" -v "C:\Program Files (x86)\Jenkins\workspace\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA@tmp:C:\Program Files (x86)\Jenkins\workspace\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA@tmp:rw,z" -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** mksondej/aspnet-node-msbuild cat
      

       

      and the result is:

       

      java.io.IOException: Failed to run image 'mksondej/aspnet-node-msbuild'. Error: docker: Error response from daemon: invalid bind mount spec "C:\\Program Files (x86)\\Jenkins\\workspace\\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA:C:\\Program Files (x86)\\Jenkins\\workspace\\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA:rw,z": invalid volume specification: 'C:\Program Files (x86)\Jenkins\workspace\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA:C:\Program Files (x86)\Jenkins\workspace\test1_master-X2GYJHOEIWFTSVMPO3GB3GYF3NB4R7IFICRXKGCY7NVNWOUOC5QA:rw,z'
      

      It seems that running windows containers in the pipeline is currently impossible?

      By manually fiddling with the command above I've found out that without ":z" ("rw" can stay) it would work properly. I've tried to make a crude workaround by making a bat cmd somewhere in my PATH which would make a simple string replacement, but it only worked from my or other user's command line. The pipeline seems to run docker.exe directly.

      Any wokaround would be more than welcome, thanks

       

            Unassigned Unassigned
            mksondej Michał Sondej
            Votes:
            7 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: