Jenkins with Docker on Windows - Cannot run progra

2019-04-06 20:59发布

I am using the Jenkins Azure VM Agents Plugin with a Linux Master, to launch jobs on Windows agents.

I have been through all the configuration steps and everything works fine until I try to use Docker on the agents.

My pipeline script:

pipeline {
    agent {
        docker {
            image 'myurl.io/myimage:latest'
            registryUrl 'https://myurl.io/'
            registryCredentialsId '123456789abcdefg'
        }
    }

The pipeline appears to fails on when it runs this command:

docker pull myurl.io/myimage:latest

The error reported comes down to this:

Caused: java.io.IOException: Cannot run program "nohup" (in directory "C:\Jenkins\workspace\Test Pipeline Docker"): CreateProcess error=2, The system cannot find the file specified

Some notes:

  • I have ticked the box to install git on the image: enter image description here

  • The Git tools appear to be successfully installed on the agent VM

  • This question seems to be related but is it not exactly the same

    • I am not running the sh command directly, it is being run by the plugin.
    • I do not think I have access to set the PATH at this stage
  • This issue on JIRA https://issues.jenkins-ci.org/browse/JENKINS-36776 is related, but it does not seems to be fixed and the suggested workarounds don't seem to apply to my situation

My question

Is there a way to get my pipeline script to work? Maybe there are some extra commands I can somehow execute on the agent after it launches - but before the docker pull command - to add the required directories to the PATH?

Or is there some other workaround?

0条回答
登录 后发表回答