How to run jenkins pipeline job with docker comman

2019-07-30 18:38发布

问题:

I have a jenkins pipeline script which creates the Docker image and deploys it to the docker hub. I have installed the docker plugin but it complains about "docker command not found". I am not sure if I need to install docker in the same machine or something else need to happen?

回答1:

Yes you have to install docker on the slave machine which is running that pipeline script of docker plugin. I would suggest adding a label docker to the slave that has docker installed and then use the pipeline script as:

node('docker') {
...
}