我想使用Docker在服务器A上设置Jenkins master,在服务器B上设置slave.
两台服务器都是专用于Jenkins的虚拟机.
目前我已经在服务器A上为主服务器启动了Docker容器,基于官方的Jenkins docker镜像.但是我应该为jenkins奴隶使用什么码头图像?
您可以将evarga/jenkins-slave用作构建从站的良好起点.
此图像已包含JDK.如果您只需要构建从属服务器上的JDK和Maven,则可以使用以下Dockerfile构建Docker镜像:
FROM evarga/jenkins-slave
run apt-get install maven
将Docker镜像用于构建从属实际上是一个好主意.部分原因出现在Templating Jenkins Build Environments with Docker Containers:
Docker has established itself as a popular and convenient way to
bootstrap isolated and reproducible environments,which enables Docker
containers to be the most maintainable slave environments. Docker
containers’ tooling and other configurations can be version controlled
in an environment definition called a Dockerfile,and Dockerfiles
allows multiple identical containers can be created quickly using this
definition or for more customized off-shoots to be created by using
that Dockerfile’s image as a base.