Using Docker in jenkins with jenkins Docker agent
Running Jenkins CI agents as containers is a nice thing. However it can be a hassle if you want to build a container inside the containerized docker agent. Using the standard Jenkins agent container will result in an error telling you that the Docker binary is not found.
The default Jenkins agent container doesn’t contain the Docker binaries. 😔
But the Jenkins JNLP agent Docker container does! 😀
Unfortunately the image is missing any description and finding any documentation is hard. You can neither view the Dockerfile nor is the source linked. But in the GitHub repository for the JNLP Agents is a subdirectory called
docker in which you can find this Dockerfile. This seems to be the source for the linked image. One can see that the Docker binary is getting installed on build time.
In order to use the agent go to your Jenkins server settings and click on
Manage Nodes and Clouds →
If you haven’t already set your Docker settings:
Docker Host URI:
Then open the Docker Agent templates section.
Change the Docker Image to:
After that open the container settings and set the following:
Thats it. Happy dockerizing 🙂