This blog, which I wrote, has plenty of info on the problems with running Jenkins pipelines with Docker.
I recently founded a company called Nestybox that has created a container runtime (aka runc) that enables Docker to deploy containers that act like virtual hosts and can run system-level software such as Docker in them, without using privileged containers. It solves many of the issues described by Jerome in his docker-in-docker blog post (see Jerome’s comment above).
We have a solution that runs Jenkins + Docker inside the system container, avoids many of the problems listed in this thread, and does so in complete isolation from the Docker on the host. Check it out, hopefully it will help!
Awesome stuff! This worked perfectly for me! I simply spun up a ubuntu 19.04 VM, and followed the Sysbox Installation Guide and @ctalledo’s blog post and was able to get Docker working in Jenkins pipelines (running in a dockerized Jenkins installation). More details here.
none of these are working for me
I’ve tried -u root and --group-add 0, --privileged too. $(which docker) is not working inside the docker command buts works separately so I’ve replaced $(which docker) with the $(which docker) literal which is something like C:/Program Files/..../bin/docker.
I’ve also tried docker on docker but not working.
I’d be happy if I’ve got a separate error. But Jenkins is giving me
/usr/bin/docker: 5: /usr/bin/docker: Cannot fork
because it cannot identify docker after all this. help
but how to resolve this at host level,as my jenkins pod running in kubernetes and facing the same issue,if any body can help me with the deployment.yaml file
This is the answer in case you struggle with the same issue.
docker run
-u root
–rm
-d
-p 8080:8080
-p 50000:50000
–name myjenkin
-v $(which docker):/usr/bin/docker
-v jenkins-data:/var/jenkins_home
-v /var/run/docker.sock:/var/run/docker.sock
jenkins/jenkins
this is not working for me either, can you pls help me
I got this error
ocker: Error response from daemon: error while creating mount source path ‘/usr/bin/docker’: mkdir /usr/bin/docker: read-only file system.
ERRO[0095] error waiting for container: