Jenkins Docker Plugin似乎并没有为Jenkins构buildconfiguration从属容器

  • Docker主机金属操作系统 – CentOS 7.3
  • Jenkins Master在Docker主机金属的容器中运行
  • jenkins2.6
  • Docker主机金属监听端口4243

我不是很熟悉Jenkins Docker插件 ,这可能是我的问题。 但现在我的问题是,我期待的Docker插件在我的Docker主机上旋转容器,我已经在JenkinsconfigurationDocker插件中将我的Docker主机configuration为一个Cloud,而Docker插件可以连接到我的Docker主机按“testing连接”: 在这里输入图像说明

我在Docker Hub上使用了一个非常常见的Docker镜像作为Slave,在这一点上并不重要,因为Docker插件甚至没有尝试启动一个Docker容器从站: 在这里输入图像说明

这里是我简单的jenkins工作的configuration,运行,拉动源代码和完成没有错误,永远不会在任何一点转动奴隶容器towork: 在这里输入图像说明 在这里输入图像说明

下面是运行的输出没有错误: 在这里输入图像说明

  • 安装Docker插件后,我重新启动了Jenkins
  • Docker安装在我的Jenkins主容器上
  • Docker插件可以和我的Docker主机通信

这是我的Jenkins Master Dockerfile

#reference #https://engineering.riotgames.com/news/putting-jenkins-docker-container FROM jenkins:2.46.3 MAINTAINER Brian Ogden #setup folder for jenkins to log and save war file to USER root RUN apt-get update && apt-get install -y make apt-transport-https ca-certificates curl gnupg2 software-properties-common RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" RUN apt-get update && apt-get install -y docker-ce RUN mkdir /var/log/jenkins RUN mkdir /var/cache/jenkins RUN chown -R jenkins:jenkins /var/log/jenkins RUN chown -R jenkins:jenkins /var/cache/jenkins RUN gpasswd -a jenkins docker USER jenkins #give Jenkins a nice 8 GB memory pool and room to handle garbage collection #ENV JAVA_OPTS="-Xmx8192m" #give Jenkins a nice base pool of handlers and a cap #ENV JENKINS_OPTS="--handlerCountStartup=100 --handlerCountMax=300" ENV JENKINS_OPTS="--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war" 

这里是我想要最终实现的一个图表: 在这里输入图像说明

好吧,我觉得这要归功于这篇文章 。 正如我怀疑这是我的Jenkins Docker插件configuration设置。

首先我必须给我的奴隶泊坞模板图像一个标签:

在这里输入图像说明

然后,我不得不将我的Jenkins生成项目configuration更改为: 在这里输入图像说明

现在,Docker插件正在我的Docker主机上提供一个从属容器