For a dockerized agent to be able to run docker pipeline, it has to use a volume for workspace directory so this one can be shared with other containers it creates. Your docker agent template should be configured to use "/home/jenkins/agent" as agent root directory, as this one is a volume and as such workspace sub-folder will be shareable with other containers.
2018-02-26 5:14 GMT+01:00 Christian Gagneraud <[email protected]>: > On 26 February 2018 at 15:29, Christian Gagneraud <[email protected]> > wrote: > > On 26 February 2018 at 03:10, nicolas de loof <[email protected]> > wrote: > >> docker support in declarative pipeline relies on docker-workfow plugin, > >> which require the jenkins slave to have access to a LOCAL docker daemon, > >> which means the docker agent you are provisioning on computer B using > docker > >> plugin HAS to be configured with /var/run/docker.sock (so, the one from > B) > >> bind mounted. Doing so it can then create some side container to host > the > >> build steps. > > > > Hi Nicolas, > > > > Thanks for the tips, i think i'm getting there, but i'm still missing > some bits: > > - I have created a docker image based on jenkinsci/jnlp-slave, the > > only customisation is installing docker in it > > - The pipeline now get checkout inside tmy slave (on machine B) > > - The docker image from the Jenkinsfile is pulled and executed. > > > > But i get this weird error (see full log at the end of this email): > > ------------------------ > > docker-44734997459c on work-leader seems to be running inside > > container e7f7a4381e32c456b806695b9b7334751d88f1a3985867bb964e9fd3d2e8 > c948 > > but /home/jenkins/workspace/aa_aaa_master-GQ43GQETZSZCK3GMCGYSLEW5TKL7YK > HSBXYJPJLEX7A2AM6K5M6Q > > could not be found among [/home/jenkins/.jenkins, /home/jenkins/agent] > > Google didn't return much with "could not be found among" > > https://stackoverflow.com/questions/47559469/jenkins- > declarative-pipeline-docker-agent-timeout-run?rq=1 > https://tutel.me/c/programming/questions/46530963/run+jenkins+agent+in+ > docker+container+issue+with+jenkins+pipeline+and+varrundockersocket > > Not very useful, but using google's "repeat the search with the > omitted results included.", I got a few extra results, one of them, an > IRD log, that gave me the answer: > https://echelog.com/logs/browse/jenkins/1497304800 > > I had to add /home/jenkins in the "Volumes" of the "Docker Agent > templates" (as well as "Remoting Filling System Root", but this was > set by default). > I noticed as well that if no "user" is specified in the "Connect > method"/"Attach Docker Container", the Python image script will be run > with id 1000:1000, which does not exists. But this doesn't seem to be > a problem. (user=root is not required, nor is "Run container > privileged"). > > Thanks! > Chris > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/jenkinsci-users/CABxGUTjm_P7nc0pk2WntGjq1BX2Eoacn6tD9xqw > skjLpxg2_ZA%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CANMVJz%3DL%3DP3ZGcPTEdEJi2eEfyM1Su-0sHDUoPQHN95qrHcAuA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
