Custom Jenkins images
So far, we have used Jenkins images pulled from the internet. We used jenkins/jenkins
for the master container and jenkins/agent
(or jenkins/inbound-agent
or jenkins/ssh-agent
) for the agent container. However, you may want to build your own images to satisfy the specific build environment requirements. In this section, we will cover how to do it.
Building the Jenkins agent
Let's start with the agent image because it's more frequently customized. The build execution is performed on the agent, so it's the agent that needs to have the environment adjusted to the project we want to build – for example, it may require the Python interpreter if our project is written in Python. The same applies to any library, tool, or testing framework, or anything that is needed by the project.
There are four steps to building and using the custom image:
- Create a Docker file.
- Build the image.
- Push the image...