gpt4 book ai didi

docker - Jenkins Docker插件似乎并未为Jenkins构建提供从属容器

转载 作者:行者123 更新时间:2023-12-02 19:36:19 25 4
gpt4 key购买 nike

  • Docker主机金属操作系统-CentOS 7.3
  • 在Docker主机金属上的容器中运行的Jenkins Master
  • Jenkins 2.6
  • 侦听端口4243上的Docker主机金属

  • 我对Jenkins的 Docker Plugin不太熟悉,这可能确实是我的问题。但是现在我的问题是我希望Docker插件在Docker主机上启动一个容器,我已经在Docker插件的Jenkins配置中将Docker主机配置为云,并且当我将Docker插件连接到我的Docker主机时按“测试连接”:
    enter image description here

    我在Docker Hub上使用了一个非常常见的Docker镜像作为Slave,这并不重要,因为Docker插件甚至没有尝试启动Docker容器从属设备: enter image description here

    这是我简单的Jenkins作业的配置,该作业运行,提取源代码并完成而没有错误,并且从未在任何工作时启动Slave Container:
    enter image description here
    enter image description here

    这是正在运行且没有错误的作业的输出:
    enter image description here
  • 我在安装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"

    这是我最终要达到的目标的图表: enter image description here

    最佳答案

    好的,我感谢这个article。我怀疑这是我的Jenkins Docker插件配置设置。

    首先,我必须给我的从属Docker模板镜像添加标签:

    enter image description here

    然后,我不得不将我的Jenkins Build项目配置更改为:enter image description here

    现在Docker插件正在Docker主机上配置一个从属容器

    关于docker - Jenkins Docker插件似乎并未为Jenkins构建提供从属容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44835104/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com