简体   繁体   English

Docker将Jenkins容器更新为映像

[英]Docker update Jenkins container to image

I´m using a Docker Jenkins image, but I need to update the current version with some plugins. 我正在使用Docker Jenkins映像,但是我需要使用一些插件来更新当前版本。 The idea is use the very same image in an environment where I dont have internet access so there´s no way I can add those plugins, so my idea was create a new image from the current container. 我的想法是在无法访问互联网的环境中使用相同的映像,因此无法添加这些插件,因此我的想法是从当前容器中创建一个新映像。

I read that is possible and I follow the steps: 我读到这是可能的,然后执行以下步骤:

Create new image 建立新图片

sudo docker commit CONTAINER_ID new_image_name

Run new image 运行新图片

sudo docker run --name cutom_image -p 8080:8080 -p 50000:50000 -e TERM=xterm -d new_image_name

But then when I connect by ssh to the container of the new updated image I cannot see any new installed plugin. 但是,当我通过ssh连接到新的更新映像的容器时,我看不到任何新安装的插件。

But when I see the size of the new image I can see that is a little bit bigger, so there´s must be some change. 但是,当我看到新图像的大小时,可以看到它有些大,因此必须进行一些更改。

Any idea what I´m doing wrong? 知道我在做什么错吗?

Regards. 问候。

The Jenkins/Jenkins docker image is normally run with: Jenkins / Jenkins泊坞映像通常使用以下命令运行:

docker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts

this will automatically create a 'jenkins_home' volume on docker host, that will survive container stop/restart/deletion. 这将在Docker主机上自动创建一个'jenkins_home'卷,该卷将在容器停止/重启/删除后继续存在。

If you commit the container, you do not commit the volume content associated with it. 如果提交容器,则不提交与之关联的卷内容。

Run your new image with the same options as your old image, and you will get back the same content (including the plugins subfolder) 使用与旧映像相同的选项运行新映像,您将获得相同的内容(包括plugins子文件夹)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM