我正在使用Docker Jenkins映像,但我需要使用一些插件更新当前版本。这个想法是在我没有互联网访问权限的环境中使用相同的图像,所以我无法添加这些插件,所以我的想法是从当前容器创建一个新图像。
我读到这是可能的,我按照以下步骤操作:
创建新图片
sudo docker run --name cutom_image -p 8080:8080 -p 50000:50000 -e TERM=xterm -d new_image_name
运行新图片
# import libraries
import csv
import urllib2
from bs4 import BeautifulSoup
# specify the url
buzzly_page = 'http://buzzlymedia.com/ourwork/'
# query the website and return the html to the variable 'page'
page = urllib2.urlopen(buzzly_page)
# parse the html
soup = BeautifulSoup(page, 'html.parser')
# write into csv-file
with open('buzzly_clients.csv', 'a') as csv_file:
writer = csv.writer(csv_file)
for div in soup.find_all('div', attrs={'class': 'avia-testimonial-meta-mini'}):
# query to get value of name
name_box = div.find('strong', attrs={'itemprop': 'name'})
name = name_box.text.strip() # remove starting and trailing
print (name)
# query to get value of job-title
job_box = div.find('span', attrs={'itemprop': 'jobTitle'})
job = job_box.text.strip() # remove starting and trailing
print (job)
writer.writerow([name, job])
但是当我通过ssh连接到新更新映像的容器时,我看不到任何新安装的插件。
但是,当我看到新图像的大小时,我可以看到它有点大,所以必须有一些改变。
知道我做错了吗?
问候。
答案 0 :(得分:2)
Jenkins/Jenkins docker image通常以:
运行docker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
这将在docker主机上自动创建一个'jenkins_home'卷,这将在容器停止/重启/删除后继续存在。
如果提交容器,则不提交与其关联的卷内容。
使用与旧图像相同的选项运行新图像,您将获得相同的内容(包括插件子文件夹)