Docker Community Forums

Share and learn in the Docker community.

Running a docker in jenkin job

hi all,

I have a docker image which i am able to run on terminal with below command

docker run -v pwd:pwd -w pwd -it "image-name/image-ID"

where i’ll be logged into docker termial. so the environment will be something like this.

builduser@jenkins-key:~$ pwd


but the same run command will not work in jenkins execute shell .so i removed -it from docker run command.

but in this case (i.e :docker run -v pwd:pwd -w pwd “image-name/image-ID”) . shell exits from docker before executing any other command.(i.e: shell comes out of docker environment and settles in ubuntu environment).

Even tried with docker run -v pwd:pwd -w pwd -it -d “image-name/image-ID” . here i can execute commands using exec flag .
(i.e docker exec 4770fdbf6400 pwd).
but in this case instead of builduser environment the shell will be set to dockers root environment…

Can someone help me to set docker jenkins setup may be as docker slave or shell excecution in jenkins.

Thanks & Regards,
Lavakumar S