How to Run jenkins on docker

This is fine but not sufficient if your jenkins pipeline has docker build or run commands in it. In that case the dockerized jenkins instance needs to talk to a docker daemon.

The typical solution is to mount /var/run/docker.sock into the jenkins container, such that jenkins inside the container will talk to the docker daemon on the host, but this comes with other challenges as described in this blog.

The blog also describes a clean solution to the problem, by placing jenkins + docker cli + docker daemon inside the container. This avoids headaches by placing jenkins in the same context as the docker daemon (i.e., both are inside a container, rather than one inside the container and the other on the host).

I recently founded Nestybox, which enables this solution without using Docker privileged containers. It has already helped others in this forum.

Hope this helps!