chengjingtao / jenkinsci-docker-agent

Base Docker image for Jenkins Agents

Home Page:https://hub.docker.com/r/jenkins/agent/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jenkins Agent Docker image

Join the chat at https://gitter.im/jenkinsci/docker GitHub stars Docker Pulls GitHub release

This is a base image for Docker, which includes JDK and the Jenkins agent executable (agent.jar). This executable is an instance of the Jenkins Remoting library. JDK version depends on the image and the platform, see the Configurations section below.

Warning! This image used to be published as jenkinsci/slave and jenkins/slave. These images are now deprecated, use jenkins/agent.

Changelog

See GitHub releases for versions 3.35-1 and above. There is no changelog for previous versions, see the commit history.

Jenkins remoting changelogs are available here.

Usage

This image is used as the basis for the Docker Inbound Agent image. In that image, the container is launched externally and attaches to Jenkins.

This image may instead be used to launch an agent using the Launch method of Launch agent via execution of command on the master. For example on Linux you can try

docker run -i --rm --name agent --init jenkins/agent java -jar /usr/share/jenkins/agent.jar

after setting Remote root directory to /home/jenkins/agent.

or if using Windows Containers

docker run -i --rm --name agent --init jenkins/agent:jdk11-windowsservercore-ltsc2019 java -jar C:/ProgramData/Jenkins/agent.jar

after setting Remote root directory to C:\Users\jenkins\Agent.

Agent Work Directories

Starting from Remoting 3.8 there is a support of Work directories, which provides logging by default and change the JAR Caching behavior.

Call example for Linux:

docker run -i --rm --name agent1 --init -v agent1-workdir:/home/jenkins/agent jenkins/agent java -jar /usr/share/jenkins/agent.jar -workDir /home/jenkins/agent

Call example for Windows Containers:

docker run -i --rm --name agent1 --init -v agent1-workdir:C:/Users/jenkins/Work jenkins/agent:jdk11-windowsservercore-ltsc2019 java -jar C:/ProgramData/Jenkins/agent.jar -workDir C:/Users/jenkins/Work

Configurations

The image has several supported configurations, which can be accessed via the following tags:

  • Linux Images:

    • latest (jdk8, buster-jdk8, latest-jdk8, latest-buster-jdk8): Latest version with the newest remoting (based on adoptopenjdk/openjdk8:jdk8u${version}-debian)
    • latest-jdk11 (jdk11, buster-jdk11, latest-buster-jdk11): Latest version with the newest remoting and Java 11 (based on adoptopenjdk/openjdk11:jdk-${version}-debian)
    • alpine (alpine-jdk8, latest-alpine, latest-alpine-jdk8): Small image based on Alpine Linux (based on adoptopenjdk/openjdk8:jdk8u${version}-alpine)
    • alpine-jdk11 (latest-alpine-jdk11): Small image based on Alpine Linux (based on adoptopenjdk/openjdk11:alpine)
    • archlinux (latest-archlinux, archlinux-jdk11, latest-archlinux-jdk11): Image based on Arch Linux with JDK11 (based on archlinux:latest)
  • Windows Images:

    • jdk11-windowsservercore-1809: Latest version with the newest remoting and Java 11 (based on adoptopenjdk:11-jdk-hotspot-windowsservercore-1809)
    • jdk11-nanoserver-1809: Latest version with the newest remoting with Windows Nano Server and Java 11

The file docker-bake.hcl defines all the configuration for Linux images and their associated tags.

There are also versioned tags in DockerHub, and they are recommended for production use. See the full list here

Java 8 Support

Please note that the following Java 8 images have been deprecated:

  • jdk8-nanoserver-1809: Windows nanoserver 18.09 with JDK8
  • jdk8-windowsservercore-1809: Windows Server Core 18.09 with JDK8 (based on adoptopenjdk:8-jdk-hotspot-windowsservercore-1809)

About

Base Docker image for Jenkins Agents

https://hub.docker.com/r/jenkins/agent/

License:MIT License


Languages

Language:Dockerfile 46.0%Language:PowerShell 33.0%Language:Shell 10.4%Language:Makefile 5.5%Language:HCL 5.1%