CloudBees Docker Build and Publish plugin — This plugin provides the ability to build projects with a Dockerfile, and publish the resultant tagged image (repo) to the docker registry.
Docker build step plugin — This plugin allows to add various Docker commands into you job as a build step.
Docker Plugin — This plugin allows slaves to be dynamically provisioned using Docker.
Kubernetes Plugin — This plugin allows slaves to be dynamically provisioned on multiple Docker hosts using Kubernetes.
Docker Commons Plugin — APIs for using Docker from other plugins.
其中,它们间的关系如下:
Docker commons Plugin为其他与Docker相关的插件提供了APIs
CloudBees Docker Build and Publish plugin和Docker build step plugin都依赖了Docker commons Plugin
Kubernetes Plugin依赖了Docker Plugin
下面主要介绍下Docker build step plugin和CloudBees Docker Build and Publish plugin的使用。
Docker build step plugin使用 设置Docker URL系统管理→系统设置→Docker Builder,设置Docker URL并测试连接。
有一系列Docker Command可选择
选择Restart containers命令,并填写Container ID(s):
Jenkins JOB创建成功后,点击构建,日志输出如下:
选择Push images命令,并填写相关信息:
Jenkins JOB创建成功后,点击构建,日志输出如下:
该项目是个Docker化的项目,Dockerfile在根目录下
此外,Docker Build Publish Plugin还要一些高级选项