0
votes

I am having a Master slave setup in jenkins, where all of my slave machines are docker slaves.

I am using Yet another docker plugin to configure these slaves. All my jobs are passing successfully on the slave nodes, but I cannot view the workspace from the jenkins UI. Is this because the container gets destroyed after the build is getting executed successfully? If yes, then what is a work around to view the workspace.

1
If you wants to preserver the workspace you need to provide docker run -it -v host-dir:container-dir $image-name otherwise it will not preserver the workspace. This feature is called Volume mount in docker. Thanks - chintan thakar
will this help me view the workspace in UI? - B.T Anand
Yes, But the condition is it should not stop your container. If you want to stop container than I would recommend use shared storage for persist data of any container and that should be permanently mounted on jenkins UI. - chintan thakar
okay, so well I would want to stop the containers, because there are alot of builds and I would want to clean it up, after the build is done. Can you please elaborate on how to use a shared storage for persisting data? - B.T Anand

1 Answers

0
votes

So you want to persist the storage of all the containers which has been initiated when build triggered and stopped when build finished. correct ?

Let's consider You mount one large partition on as a shared storage. /opt or anything of your choice.

So when you triggered build it should initiate container with docker run -it --name ${JOB_NUMBER} -v /opt/$JOB_NUBER:$PATH_OF_BUILD $image-name so now this /opt/ partition should be shared storage like nfs or sshfs and that should also be binded with jenkins-master nodes so when you navigate to any job workspace you should able to see /opt/ partition data over there.

Thank you!