Note: This plugin is officially "up for adoption". It would benefit from having a new maintainer who uses it "for real work" and is thus able to test things "for real" before release instead of relying purely on the unit tests.
This plugin allows containers to be dynamically provisioned as Jenkins nodes using Docker. It is a Jenkins Cloud plugin for Docker.
The aim of this docker plugin is to be able to use a Docker host to dynamically provision a docker container as a Jenkins agent node, let that run a single build, then tear-down that node, without the build process (or Jenkins job definition) requiring any awareness of docker.
The Jenkins administrator configures Jenkins with knowledge of one or more docker hosts (or swarms), knowledge of one or more "templates" (which describe the labels/tags that this template provides, the docker image, how to start it, etc) and Jenkins can then run docker containers to provide Jenkins (agent) Nodes on which Jenkins can run builds.
Note: There is more than one docker plugin for Jenkins.
While this can be confusing for end-users, it's even more confusing when end users report bugs in the wrong place.
e.g. if you are using Jenkins
pipeline / workflow / Jenkinsfile
builds with code including terms like
docker.withDockerRegistry
or
docker.image
etc then you're using the
docker-workflow
plugin and should go to its repository instead of this one.
Note: This plugin does not use the OS's native docker client; it uses docker-java. You do not need to install a docker client on Jenkins or on your agents to use this plugin.
Note: This plugin does not provide a Docker daemon; it allows Jenkins to use a docker daemon. i.e. Once you've installed docker somewhere, this plugin will allow Jenkins to make use of it.
A quick setup is :
Follow the installation steps on the docker website.
If your Jenkins instance is not on the same OS as the docker install, you will need to open the docker TCP port so that Jenkins can communicate with the docker daemon. This can be achieved by editing the docker config file and setting (for example)
DOCKER_OPTS="-H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock"
The docker configuration file location will depend your system, but it
is likely to be
/etc/init/docker.conf
,
/etc/default/docker
or
/etc/default/docker.io.
If you want to use more than just one physical node to run containers, you can use Docker Swarm Standalone or you can define more than one docker "cloud". The docker engine swarm mode API is not supported (at present; enhancement contributions would be welcomed).
To use the standalone swarm, follow docker swarm standalone instructions and configure Jenkins with the swarm's API endpoint.
Docker plugin is a "Cloud" implementation. You'll need to edit Jenkins system configuration (Jenkins -> Manage -> System configuration) and add a new Cloud of type "Docker".

Configure Docker (or Swarm standalone) API URL with required credentials. The test button lets you check the connection.
Then configure Agent templates, assigning them labels that you can use so your jobs select the appropriate template, and set the docker container to be run with whatever container settings you require.
You need a docker image that can be used to run Jenkins agent runtime. Depending on the launch method you select, there's some prerequisites for the Docker image to be used:
When using the jenkins/ssh-agent Docker image, ensure that the user
is set to jenkins.
For backward compatibility or non-standard sshd packaged in your
docker image, you also have option to provide manually configured
ssh credentialsTo create a custom image and bundle your favorite tools,
create a Dockerfile with the FROM to point to one of the
jenkins/*-agent
reference images,
and install everything needed for your own usage, e.g.
FROM jenkins/inbound-agent
RUN apt-get update && apt-get install XXX
COPY your-favorite-tool-here
Avoid overriding the docker command, as the SSH Launcher relies on it.
You can use an Entrypoint to run some side service inside your build agent container before the agent runtime starts and establish a connection ... but you MUST ensure your entrypoint eventually runs the passed command:
exec "$@"
More information can be obtained from the online help built into the Jenkins web UI. Most configurable fields have explanatory text. This, combined with knowledge of docker itself, should answer most questions.
Jenkins and the docker-plugin can be configured using Groovy code and/or using the JCasC plugin.
If you're unsure which method to use, use JCasC.
Install the configuration-as-code plugin and follow its example.
As another alternative, a Docker daemon can listen to requests from remote hosts by following the Docker documentation. The following configuration as code example creates a cloud named "my-docker-cloud" that uses the docker daemon at port 2375 on dockerhost.example.com to run up to 3 containerized agents at a time. Agents run the Jenkins Alpine inbound agent container image with Java 21. Thay use an inbound connection and run as the user ID 1000 with the home directory "/home/jenkins/agent".
jenkins: clouds: - docker: containerCap: 3 dockerApi: connectTimeout: 23 dockerHost: uri: "tcp://dockerhost.example.com:2375" readTimeout: 43 errorDuration: 313 name: "my-docker-cloud" templates: - connector: jnlp: jenkinsUrl: "https://jenkins.example.com/" user: "1000" dockerTemplateBase: cpuPeriod: 0 cpuQuota: 0 image: "jenkins/inbound-agent:latest-alpine-jdk21" labelString: "alpine jdk21 alpine-jdk21 git-2.43" name: "alpine-jdk21" pullTimeout: 171 remoteFs: "/home/jenkins/agent"
For example, this
configuration script
could be run automatically upon
Jenkins post-initialization
or through the
Jenkins script console.
If run,
this script will configure the docker-plugin to look for a docker daemon running within the same OS as the Jenkins controller
(connecting to Docker service through unix:///var/run/docker.sock)
and with the containers connecting to Jenkins using the "attach" method.


免费创建高清无水印Sora视频
Vora是一个免费创建高清无水印Sora视频的AI工具


最适合小白的AI自动化工作流平台
无需编码,轻松生成可复用、可变现的AI自动化工作流

大模型驱动的Excel数据处理工具
基于大模型交互的表格处理系统,允许用户通过对话方式完成数据整理和可视化分析。系统采用机器学习算法解析用户指令,自动执行排序、公式计算和数据透视等操作,支持多种文件格式导入导出。数据处理响应速度保持在0.8秒以内,支持超过100万行数据的即时分析。


AI辅助编程,代码自动修复
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。


AI论文写作指导平台
AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。


AI一键生成PPT,就用博思AIPPT!
博思AIPPT,新一代的AI生成PPT平台,支持智能生成PPT、AI美化PPT、文本&链接生成PPT、导入Word/PDF/Markdown文档生成PPT等,内置海量精美PPT模板,涵盖商务、教育、科技等不同风格,同时针对每个页面提供多种版式,一键自适应切换,完美适配各种办公场景。


AI赋能电商视觉革命,一站式智能商拍平台
潮际好麦深耕服装行业,是国内AI试衣效果最好的软件。使用先进AIGC能力为电商卖家批量提供优质的、低成本的商拍图。合作品牌有Shein、Lazada、安踏、百丽等65个国内外头部品牌,以及国内10万+淘宝、天猫、京东等主流平台的品牌商家,为卖家节省将近85%的出图成本,提升约3倍出图效率,让品牌能够快速上架。


企业专属的AI法律顾问
iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。


稳定高效的流量提升解决方案,助力品牌曝光
稳定高效的流量提升解决方案,助力品牌曝光


最新版Sora2模型免费使用,一键生成无水印视频
最新版Sora2模型免费使用,一键生成无水印视频
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号