How to use docker inside jenkins pipeline without using docker-in-docker

Viewed 257

The author of docker-in-docker suggested not to use this image for CI purposes here in this blog: jpetazzo/Using Docker-in-Docker for your CI or testing environment? Think twice

Why Jenkins uses docker-in-docker in Jenkins user Handbook(installing section)in the following link: Installing Jenkins(you can see it in step 4)

Why didn't they just use volume for using docker daemon as follows:

--volume /var/run/docker.sock:/var/run/docker.sock

Is there any specific reason for using docker-in-docker?

If you agree that it should have been done without using docker-in-docker, please tell me how to do it that way, actually I have already tried to do it with no luck and I came across another question here: How to find out which user is accessing /var/run/docker.sock that will cause permission denied error

1 Answers

@tashkhisi - As already mentioned in https://stackoverflow.com/a/63200614/8723275 it depends which Jenkins image you are trying to use. In case you will be using jenkinsci/bleocean - it already has docker inside pipeline, but you are on your own. In case you prefer using jenkins/jenkins image - you may find answers in the following discussion. One possible solution would be to build your own Jenkins image and dynamically install in the image all needed plugins.

Related