This image is based on the jenkinsci/docker-jnlp-slave:alpine but extends from CentOS 7 (centos:7.3.1611) instead of Alpine Linux (openjdk:8-jdk-alpine).
The agent (slave.jar
) used in this image relies on the Jenkins Remoting library and is taken from the base Jenkins Agent Docker image.
This image is ready-to-use for the Jenkins Kubernetes Plugin.
See Jenkins Distributed builds for more information about how to use Jenkins agents.
Run a Docker container with
docker run mhelm/docker-centos-slave:latest -url http://jenkins-server:port <secret> <agent name>
Optional environment variables:
JENKINS_URL
: url for the Jenkins server, can be used as a replacement to-url
option, or to set alternate jenkins URLJENKINS_TUNNEL
: (HOST:PORT
) connect to this agent's host and port instead of the Jenkins server directly, assuming this one routes TCP traffic to the Jenkins masterJENKINS_SECRET
: agent secret, if not set as an argumentJENKINS_AGENT_NAME
: agent name, if not set as an argument
In the Jenkinsfile
use this Docker image in the containerTemplate
of the Jenkins Kubernetes Plugin.
Avoid using the container
step in the pipeline script as it makes the build unstable (see JENKINS-40825).
podTemplate(label: 'kubernetes', containers: [
containerTemplate(
name: 'jnlp',
image: 'mhelm/docker-centos-slave:latest',
args: '${computer.jnlpmac} ${computer.name}',
ttyEnabled: true,
env: [
containerEnvVar(key: ..., value: ...)
]
)
]) {
node('kubernetes') {
...
}
}