Jenkins is one of the most famous
continuous integration and deployment tools, it’s written in Java and it helps
you to manage your pipeline and all tasks that help you to put your code in
production or manage your build.

The announcement of Jenkins release of version 2 few days ago, is one of the
best release of this year in my opinion.

The previous version is very stable but it has a lot of years and the ecosystem
is totally different. I am happy to see a strong refurbishment to get the best
of this powerful tool with a series of new feature like:

Nice installation wizard

Refactoring of the design, one of the most critical
feature of the previous version

Jenkins is truly a wonder but the tool of the moment it’s docker, engine
that allow you to work easier with the containers.

This two tools together are perfect to create an isolated environment to test
and deploy your applications.

The first setup could be install Jenkins on your
server and use a plugin to manage the integration and trigger your test inside
an isolated environment, the container.

Great work but in my opinion reproducibility is one of the critical point when
you deal with plugins if you can not run your build on your local environment
easily then you have a problem. Secondly if the container could be a good
solution to deploy and maintain a solid and isolated application, why your
Jenkins has not the privilege to run inside a container? In this perspective
how can we run container inside a container?

Ok, now its the time to figure it out how to solve the problems.

We can use the official Jenkins image to put jenkins inside a container, but I
worked on my personal alpine installation, light and easy, here is the
dockerfile
and we can pull it:

docker pull gianarb/jenkins:2.0

If you are interested the main article to understand how run docker inside
docker is written by
jpetazzo,
the idea is run our jenkins container with -privileged enabled and share our
docker binary and the socket /var/run/docker.sock to manage our
communications.