Jenkins docker agent in declarative pipeline: file not found -
when trying execute example https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/controlling-your-build-environment:
pipeline { agent { docker 'node' } stages { stage("testing 123") { steps { sh 'node --version' } } } }
i following output:
[pipeline] // stage [pipeline] stage [pipeline] { (declarative: agent setup) [pipeline] sh [xxxxx-aboessrh5fv5am3vlfmz4uzp722n63wt5eeae2jpixc5u5ztmbya] running shell script + docker pull node using default tag: latest latest: pulling library/node digest: sha256:a72f8cd9aba12ea3a19ada91e077c4d8822d3bd7dc3c4707b16630e5c2477845 status: image date node:latest [pipeline] } [pipeline] // stage [pipeline] sh [xxxxx-aboessrh5fv5am3vlfmz4uzp722n63wt5eeae2jpixc5u5ztmbya] running shell script + docker inspect -f . node . [pipeline] withdockercontainer [pipeline] // withdockercontainer [pipeline] } [pipeline] // node [pipeline] end of pipeline github has been notified of commit’s build result java.io.ioexception: cannot run program "docker": error=2, no such file or directory @ java.lang.processbuilder.start(processbuilder.java:1048) @ hudson.proc$localproc.<init>(proc.java:245) @ hudson.proc$localproc.<init>(proc.java:214) @ hudson.launcher$locallauncher.launch(launcher.java:846) @ hudson.launcher$procstarter.start(launcher.java:384) @ org.jenkinsci.plugins.docker.workflow.client.dockerclient.launch(dockerclient.java:268) @ org.jenkinsci.plugins.docker.workflow.client.dockerclient.launch(dockerclient.java:249) @ org.jenkinsci.plugins.docker.workflow.client.dockerclient.launch(dockerclient.java:246) @ org.jenkinsci.plugins.docker.workflow.client.dockerclient.version(dockerclient.java:218) @ org.jenkinsci.plugins.docker.workflow.withcontainerstep$execution.start(withcontainerstep.java:136) @ org.jenkinsci.plugins.workflow.cps.dsl.invokestep(dsl.java:184) @ org.jenkinsci.plugins.workflow.cps.dsl.invokemethod(dsl.java:126) @ org.jenkinsci.plugins.workflow.cps.cpsscript.invokemethod(cpsscript.java:108) @ org.codehaus.groovy.runtime.callsite.pogometaclasssite.call(pogometaclasssite.java:48) @ org.codehaus.groovy.runtime.callsite.callsitearray.defaultcall(callsitearray.java:48) @ org.codehaus.groovy.runtime.callsite.abstractcallsite.call(abstractcallsite.java:113) @ com.cloudbees.groovy.cps.sandbox.defaultinvoker.methodcall(defaultinvoker.java:18) @ org.jenkinsci.plugins.docker.workflow.docker$image.inside(jar:file:/users/shared/jenkins/home/plugins/docker-workflow/web-inf/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/docker.groovy:128) @ org.jenkinsci.plugins.docker.workflow.docker.node(jar:file:/users/shared/jenkins/home/plugins/docker-workflow/web-inf/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/docker.groovy:63) @ org.jenkinsci.plugins.docker.workflow.docker$image.inside(jar:file:/users/shared/jenkins/home/plugins/docker-workflow/web-inf/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/docker.groovy:116) @ org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.dockerpipelinescript.runimage(jar:file:/users/shared/jenkins/home/plugins/pipeline-model-definition/web-inf/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/dockerpipelinescript.groovy:54) @ org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.abstractdockerpipelinescript.configureregistry(jar:file:/users/shared/jenkins/home/plugins/pipeline-model-definition/web-inf/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/abstractdockerpipelinescript.groovy:68) @ org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.abstractdockerpipelinescript.run(jar:file:/users/shared/jenkins/home/plugins/pipeline-model-definition/web-inf/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/abstractdockerpipelinescript.groovy:54) @ org.jenkinsci.plugins.pipeline.modeldefinition.agent.checkoutscript.checkoutandrun(jar:file:/users/shared/jenkins/home/plugins/pipeline-model-extensions/web-inf/lib/pipeline-model-extensions.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/checkoutscript.groovy:57) @ org.jenkinsci.plugins.pipeline.modeldefinition.agent.checkoutscript.docheckout(jar:file:/users/shared/jenkins/home/plugins/pipeline-model-extensions/web-inf/lib/pipeline-model-extensions.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/checkoutscript.groovy:40) @ org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.labelscript.run(jar:file:/users/shared/jenkins/home/plugins/pipeline-model-definition/web-inf/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/labelscript.groovy:44) @ ___cps.transform___(native method) @ com.cloudbees.groovy.cps.impl.continuationgroup.methodcall(continuationgroup.java:57) @ com.cloudbees.groovy.cps.impl.functioncallblock$continuationimpl.dispatchorarg(functioncallblock.java:109) @ com.cloudbees.groovy.cps.impl.functioncallblock$continuationimpl.fixarg(functioncallblock.java:82) @ sun.reflect.generatedmethodaccessor268.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:498) @ com.cloudbees.groovy.cps.impl.continuationptr$continuationimpl.receive(continuationptr.java:72) @ com.cloudbees.groovy.cps.impl.closureblock.eval(closureblock.java:46) @ com.cloudbees.groovy.cps.next.step(next.java:74) @ com.cloudbees.groovy.cps.continuable.run0(continuable.java:154) @ org.jenkinsci.plugins.workflow.cps.sandboxcontinuable.access$001(sandboxcontinuable.java:18) @ org.jenkinsci.plugins.workflow.cps.sandboxcontinuable$1.call(sandboxcontinuable.java:33) @ org.jenkinsci.plugins.workflow.cps.sandboxcontinuable$1.call(sandboxcontinuable.java:30) @ org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.groovysandbox.runinsandbox(groovysandbox.java:108) @ org.jenkinsci.plugins.workflow.cps.sandboxcontinuable.run0(sandboxcontinuable.java:30) @ org.jenkinsci.plugins.workflow.cps.cpsthread.runnextchunk(cpsthread.java:165) @ org.jenkinsci.plugins.workflow.cps.cpsthreadgroup.run(cpsthreadgroup.java:328) @ org.jenkinsci.plugins.workflow.cps.cpsthreadgroup.access$100(cpsthreadgroup.java:80) @ org.jenkinsci.plugins.workflow.cps.cpsthreadgroup$2.call(cpsthreadgroup.java:240) @ org.jenkinsci.plugins.workflow.cps.cpsthreadgroup$2.call(cpsthreadgroup.java:228) @ org.jenkinsci.plugins.workflow.cps.cpsvmexecutorservice$2.call(cpsvmexecutorservice.java:64) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ hudson.remoting.singlelaneexecutorservice$1.run(singlelaneexecutorservice.java:112) @ jenkins.util.contextresettingexecutorservice$1.run(contextresettingexecutorservice.java:28) @ java.util.concurrent.executors$runnableadapter.call(executors.java:511) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.io.ioexception: error=2, no such file or directory @ java.lang.unixprocess.forkandexec(native method) @ java.lang.unixprocess.<init>(unixprocess.java:247) @ java.lang.processimpl.start(processimpl.java:134) @ java.lang.processbuilder.start(processbuilder.java:1029) @ hudson.proc$localproc.<init>(proc.java:245) @ hudson.proc$localproc.<init>(proc.java:214) @ hudson.launcher$locallauncher.launch(launcher.java:846) @ hudson.launcher$procstarter.start(launcher.java:384) @ org.jenkinsci.plugins.docker.workflow.client.dockerclient.launch(dockerclient.java:268) @ org.jenkinsci.plugins.docker.workflow.client.dockerclient.launch(dockerclient.java:249) @ org.jenkinsci.plugins.docker.workflow.client.dockerclient.launch(dockerclient.java:246) @ org.jenkinsci.plugins.docker.workflow.client.dockerclient.version(dockerclient.java:218) @ org.jenkinsci.plugins.docker.workflow.withcontainerstep$execution.start(withcontainerstep.java:136) @ org.jenkinsci.plugins.workflow.cps.dsl.invokestep(dsl.java:184) @ org.jenkinsci.plugins.workflow.cps.dsl.invokemethod(dsl.java:126) @ org.jenkinsci.plugins.workflow.cps.cpsscript.invokemethod(cpsscript.java:108) @ org.codehaus.groovy.runtime.callsite.pogometaclasssite.call(pogometaclasssite.java:48) @ org.codehaus.groovy.runtime.callsite.callsitearray.defaultcall(callsitearray.java:48) @ org.codehaus.groovy.runtime.callsite.abstractcallsite.call(abstractcallsite.java:113) @ com.cloudbees.groovy.cps.sandbox.defaultinvoker.methodcall(defaultinvoker.java:18) ... 29 more finished: failure
docker installed on server, , in path: image is built :-) (docker pull
command succeed @ beginning of pipeline)
i added logger on org.jenkinsci.plugins.docker.workflow.client.dockerclient
following result:
apr 07, 2017 3:56:18 pm fine org.jenkinsci.plugins.docker.workflow.client.dockerclient executing docker command docker -v
i tried launching docker in stage regular agent, same issue:
pipeline { agent stages { stage("testing 123") { agent { docker { image 'ubuntu:16.04' } } steps { sh 'uname -a' } } } }
using docker.pipeline 1.10
this seems related path configuration issue on node, can't find where.
if run org.jenkinsci.plugins.docker.commons.tools.dockertool.getexecutable("docker", jenkins.getactiveinstance(), null, null)
in node console, correct (existing, executable) docker path.
any idea ?
thanks lot!
adding ~/.zshenv
zshell (or other file) put docker in path. did , problem resolved:
$ cat ~/.zshenv export path=/usr/local/bin:$path
it looks docker inspect
not run in same env docker pull
.
on mac, docker pull
failed, configured node/agent add such name: path, value: /usr/local/bin:$path
environment variables
, docker pull
run normally. , docker inspect
failed.
then add ~/.zshenv
above (and restart node/agent), docker inspect
worked finally.
Comments
Post a Comment