【问题标题】:Downloading and running Jenkins in Docker在 Docker 中下载和运行 Jenkins
【发布时间】:2021-08-15 15:18:28
【问题描述】:

以下内容来自https://www.jenkins.io/doc/book/installing/docker/。 我在代理后面工作。 最后一条语句 RUN jenkins-plugin-cli --plugins "blueocean:1.24.7 docker-workflow:1.26" 不管用。有什么解决办法。

FROM jenkins/jenkins:2.289.3-lts-jdk11
USER root
RUN apt-get update && apt-get install -y apt-transport-https \
       ca-certificates curl gnupg2 \
       software-properties-common
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN apt-key fingerprint 0EBFCD88
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-cli
USER jenkins
RUN jenkins-plugin-cli --plugins "blueocean:1.24.7 docker-workflow:1.26"

【问题讨论】:

    标签: jenkins dockerfile


    【解决方案1】:

    您可以像在通常的 Linux shell 环境中一样使用 http_proxy 和 https_proxy 变量。尝试在 Dockerfile 中添加类似的内容:

    ENV http_proxy=http://proxy.company.com:8080 \
        https_proxy=https://proxy.company.com:443 \
        no_proxy=127.0.0.1,localhost,company.com
    

    这应该可以帮助您启用 uncletall 的答案

    【讨论】:

    • 谢谢,因为他能够下载更新并安装 docker,我认为代理部分至少可以工作......但我已将其添加到我的答案中......谢谢
    【解决方案2】:

    你不能使用 jenkins-plugin-cli 因为它不支持代理。已弃用的方法仍然有效。上次尝试我放弃并恢复了设置代理环境变量的旧方法并添加RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt

    见:https://github.com/jenkinsci/docker/issues/1005

    我已经详细说明并添加了代理配置并使用了已弃用的 install-plugins.sh

    FROM jenkins/jenkins:2.289.3-lts-jdk11
    USER root
    ENV http_proxy=http://proxy.company.com:8080 \
        https_proxy=https://proxy.company.com:443 \
        no_proxy=127.0.0.1,localhost,company.com
    RUN apt-get update && apt-get install -y apt-transport-https \
           ca-certificates curl gnupg2 \
           software-properties-common
    RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
    RUN apt-key fingerprint 0EBFCD88
    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-cli
    USER jenkins
    /usr/local/bin/install-plugins.sh docker-workflow docker-workflow blueocean
    

    【讨论】:

    • 但是如何使用代理选项运行它。运行 /usr/local/bin/install-plugins.sh
    猜你喜欢
    • 2021-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-25
    • 1970-01-01
    • 1970-01-01
    • 2018-04-29
    相关资源
    最近更新 更多