skip to Main Content

The following is taken from https://www.jenkins.io/doc/book/installing/docker/.
I am working behind proxy.
The last statement RUN jenkins-plugin-cli –plugins "blueocean:1.24.7 docker-workflow:1.26"
is not working. What would be the solution.

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"

2

Answers


  1. You can’t use jenkins-plugin-cli as it does not support a proxy. The deprecated method still works. Last time I tried I gave up and reverted the the old method of setting the proxy environment variables and adding RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt

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

    I have elaborated and added the proxy configuration and using the deprecated 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
    
    Login or Signup to reply.
  2. You can use http_proxy and https_proxy variables like in usual Linux shell environment. Try to add something like this in your 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
    

    This should help you to enable uncletall’s answer

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search