How to use a Jenkins tool installation in a docker container? How to use a Jenkins tool installation in a docker container? docker docker

How to use a Jenkins tool installation in a docker container?


You can make it available when you configure the docker container by mounting the Jenkins folder on the build agent.

pipeline {   agent {      docker {         ....        // Make tools folder available in docker (some slaves use mnt while other uses storage)        args '-v /mnt/Jenkins_MCU:/mnt/Jenkins_MCU -v /storage/Jenkins_MCU:/storage/Jenkins_MCU'         ...      }....stage(...){    environment {        myToolHome = tool 'MyTool'    }    steps {        ...        sh "${myToolHome}/path/to/binary arguments" ....

I am not sure how to get the path of the location for jenkins on the build agent, so in this example it is hard coded.But it makes the tool available in the docker image.