4

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

Tashkhisi
  • 2,070
  • 1
  • 7
  • 20
  • 2
    Just because you can do something, does not mean you necessarily should. Also, vendors often have disconnects between their sales/marketing departments and their engineering/architect departments. I have all kinds of stories for that. – Matthew Schuchard Jul 24 '20 at 17:11
  • 1
    Are you 100% sure? I don't know but maybe there is a reason behind that decision, lets listen to other's idea. I've already tried to do it using volume but there were no success, I've just asked another question to do it the other way here:https://stackoverflow.com/questions/63075375/how-to-find-out-which-user-is-accessing-var-run-docker-sock-that-will-cause-per @MattSchuchard – Tashkhisi Jul 24 '20 at 17:25
  • 1
    @tashkhisi, I also tried myself to follow David Maze's suggestion because I strongly believe he is right - didn't work on a first attempt, I'll try harder when I'll have more time. I personally use the config that I suggested on the other post for myself, at home where I don't care too much about files being corrupted hence I wipe out everything quite often. PS: good question – Neo Anderson Jul 24 '20 at 17:44
  • Advertising that you can execute something inside of Docker, on the cloud, on serverless, etc. whether it makes sense architecturally or not is a tactic sales and marketing departments at vendors use to attract money from upper management. These are attractive buzzwords that sound appealing, but are foreign in meaning to them. I would absolutely believe that is what is occurring here because I see this happen all the time. Additionally, David Maze recommending against it is a good indication not to do it. I have run in the same circles as him enough to absolutely trust him on Docker/k8s. – Matthew Schuchard Jul 24 '20 at 18:06
  • @MattSchuchard Thanks for you answer but could you please offer another approach here? David Maze suggested to use volume instead, but when I tried to do it that way, I encountered another problem, I asked this question here: https://stackoverflow.com/questions/63075375/how-to-find-out-which-user-is-accessing-var-run-docker-sock-that-will-cause-per – Tashkhisi Jul 24 '20 at 18:15

1 Answers1

0

@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.