提交给 jenkins docker 图像不保存更改 [英] Commit to jenkins docker image does not save changes
问题描述
我从这里拉取了官方的 Jenkins docker 镜像.我从 Jenkins UI 创建一个新作业,安装 github 插件并在作业配置中设置 repo url.
I pull the official Jenkins docker image from here. From Jenkins UI I create a new job , install the github plugin and set the repo urls in the job configuration.
最后我保存了 Jenkins 的更改.
Finally I save the changes from Jenkins.
我想按原样创建一个新图像.我停止容器,并将其提交到新映像.
I want to create a new image as it is. I stop the container, and commit it to a new image.
然后我从新镜像开始一个新容器...Jenkins 不包含我的任何更改.
Then I start a new container from the new image...and Jenkins does not contain any of my changes.
我使用Docker version 1.6.2,build 7c8fca2
推荐答案
Dockerfile 将 jenkins 主目录声明为卷
The Dockerfile declares the jenkins home directory as a volume
# Jenkins home directoy is a volume, so configuration and build history
# can be persisted and survive image upgrades
VOLUME /var/jenkins_home
这意味着对 Jenkins 配置的所有更改都是在 docker 镜像之外进行的.
This means all changes to the Jenkins configuration is made outside of the docker image.
项目 README 描述了如何使用预安装的插件创建自己的衍生 docker 镜像.
The project README describes how to create your own derivative docker images with plugins pre-installed.
例如
FROM jenkins
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt
这篇关于提交给 jenkins docker 图像不保存更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!