之前搭建过多次jenkins平台,不过还没有使用docker搭建过,但相信这一定是一个更方便办法。因为我爱docker。在docker中搜索jenkins,可以看到已经有官方的镜像包了。热度非常高。使用docker pull拉取镜像安装过程记录如下:本文地址:http://www.04007.cn/article/918.html,未经许可,不得转载.
root@med-1:/# docker search jenkins NAME DESCRIPTION jenkins Official Jenkins Docker image 4959 jenkins/jenkins The leading open source automation server 2275 ... root@med-1:/# docker pull jenkins Using default tag: latest Status: Downloaded newer image for jenkins:latest docker.io/library/jenkins:latest root@med-1:/# mkdir /opt/jenkins_data #添加发布专用用户并指定密码用于发布 root@med-1: /#useradd -d /home/jenkins -m -s /bin/bash jenkins root@med-1: passwd jenkins ...... #启动jenkins root@med-1:~# docker run -d -p 8080:8080 --name jenkins -u root -v /opt/jenkins_data:/var/jenkins_home jenkins本文地址:http://www.04007.cn/article/918.html,未经许可,不得转载.
启动成功后能正常访问8080页面,但在加载安装插件时全都报错,调用docker查看日志发现报错为 Caused by: java.io.IOException: Matrix Project Plugin v1.18 failed to load. - You must update Jenkins from v2.60.3 to v2.164.3 or later to run this plugin。提示jenkins版本太低,需要更新。看来docker中的jenkins版本好久没有更新了。可以直接进入容器中 /usr/local/jenkins 目录,下载官方镜像最新版jenkins,替换容器中原有的/usr/local/jenkins/jenkins.war。也可以在容器外下载传入容器内。本文地址:http://www.04007.cn/article/918.html,未经许可,不得转载.
#进入docker容器中
cd /usr/local/jenkins
wget http://mirrors.jenkins.io/war/latest/jenkins.war本文地址:http://www.04007.cn/article/918.html,未经许可,不得转载.
再次进入即解决You must update Jenkins from v2.60.3 to v2.164.3 or later to run this plugin。问题,更新后我这里的版本是Jenkins 2.265版本。期间在容器中碰到不少问题,比如Cant find any collection named fabfile fab: not found。根本没有fab环境。可以参见: http://www.04007.cn/article/738.html 不过这里是需要在容器中安装pip来安装fab,同时容器中的默认python版本是2.7,我这里最后都直接下载安装,希望容器中的python版本也赶紧升级,看提示在2021.1.1.之后就不会再支持了。安装过程记录如下:本文地址:http://www.04007.cn/article/918.html,未经许可,不得转载.
#缺少setuptools模块,下载安装 ImportError: No module named setuptools wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz tar zxvf setuptools-0.6c11.tar.gz cd setuptools-0.6c11 python setup.py install #安装pip模块 wget https://files.pythonhosted.org/packages/08/25/f204a6138dade2f6757b4ae99bc3994aac28a5602c97ddb2a35e0e22fbc4/pip-20.1.1.tar.gz tar zxvf pip-20.1.1.tar.gz cd pip-20.1.1 python setup.py install #docker容器自带python2.7后续问题 root@bc2290456599:~# pip install fabric==1.14.0 DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip,can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support本文地址:http://www.04007.cn/article/918.html,未经许可,不得转载.
本文地址:http://www.04007.cn/article/918.html 未经许可,不得转载. 手机访问本页请扫描右下方二维码.
![]() |
![]() |
手机扫码直接打开本页面 |