Sign inSign up

unaipme/jenkins-agent

By unaipme

•Updated over 5 years ago

Image
0

314

unaipme/jenkins-agent repository overview

The most basic setup for a Jenkins agent on Docker. Based on an Alpine-based OpenJDK 8 image, it includes the Jenkins agent JAR version 2.249.3. Generally speaking, the images only include what is needed to get the agent running, this is, just the OpenJDK 8 installation. That is the case for the image tagged with :latest:. However, the other two tags, :docker-cli and :docker-buildx-cli also include the Docker CLI and both Docker and Docker buildx CLI, respectively.

The image does not include a full Docker dind installation, only the CLI. It can be used so that the agent can interact with the host Docker daemon if the container is correctly setup with a bind volume. Do this at your own risk. Same goes for the buildx CLI, which can be used by running the command docker-buildx (I haven't been able to make the Docker CLI use it as a regular CLI plugin so that's that).

The image is configured with java -jar agent.jar as the entrypoint, meaning that only the agent parameters/flags need to be added for the agent to start working. These parameters are provided by the Jenkins "master" node when creating a new executor node in the web UI. The parameters should look something like:

-jnlpUrl http://${JENKINS_URL}/computer/${AGENT_NAME}/slave-agent.jnlp -secret ${SOME SECRET} -workDir "${WORKING_DIRECTORY}"

Thus, to run this dockerized agent, the following configuration is enough (with the adition of the configuration needed for Docker):

docker run --name jenkins_agent -d --restart always -v /var/run/docker.sock:/var/run/docker.sock unaipme/jenkins-agent:docker-cli -jnlpUrl http://${JENKINS_URL}/computer/${AGENT_NAME}/slave-agent.jnlp -secret ${SOME SECRET} -workDir "${WORKING_DIRECTORY}"

Again, this image does not include anything else than what has been already explicitly mentioned. No git, no python. If your builds need any dependency (and I'm positive you will be needing git for your builds), go into the container and install the dependencies using apk, the Alpine package manager.

docker exec -it jenkins_agent apk add --no-cache --update git

I am by no means responsible of the use given to this image or the information in this readme.

Tag summary

Content type

Image

Digest

Size

67.8 MB

Last updated

almost 6 years ago

docker pull unaipme/jenkins-agent