Setup Docker Jenkins with default plugins

痞子三分冷 提交于 2019-12-11 07:26:08

问题


I want to create a Jenkins based image to have some plugins installed as well as npm. To do so I have the following Dockerfile:

FROM jenkins:2.60.3
RUN install-plugins.sh bitbucket
USER root
RUN apt-get update
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
RUN npm --version
USER jenkins

That works fine however when I run the image I have two problems:

  • It seems that the plugins I tried to install manually didn't get persisted for some reason.
  • I get prompted the list of plugins I want to install but I don't want to install anything else.

Am I missing anything configuring the Dockerfile or is it that what I want to achieve is simply not possible?


回答1:


Without seeing the contents of install-plugins.sh, I can't comment as to why the plugins aren't persisting. It is most likely caused by an incorrect installation destination; persistence shouldn't be an issue at this stage, since the plugin installation is built into the image itself.

As for the latter issue, you should be able to skip the installation wizard altogether by adding the line ENV JAVA_OPTS=-Djenkins.install.runSetupWizard=false to your Dockerfile. Please note that this can be a security risk, if the Jenkins image is exposed to the world at large, since this option disables the need for authentication

EDIT: The default plugin directory for the Docker image is /var/jenkins_home/plugins

EDIT 2: According to the README on the Jenkins Docker repo, adding the line RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.stateshould accomplish the same thing



来源:https://stackoverflow.com/questions/47185493/setup-docker-jenkins-with-default-plugins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!