docker安装配置jenkins
[root@ecs-x-large-2-linux-20200317115657 ~]# docker search jenkins
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/jenkins Official Jenkins Docker image 4698 [OK]
docker.io docker.io/jenkins/jenkins The leading open source automation server 1954
docker.io docker.io/jenkinsci/blueocean https://jenkins.io/projects/blueocean 503
所有的镜像操作都是先search pull
docker search jenkins
第一个是官方的镜像,没错了就是他(其实错了…)
docker pull jenkins
然后找找文档吧,在hub.docker.com中搜索jenkins,找到这个镜像点击进去,发现确实是文档,然而第一段是个大大的通知,大意是说这个版本已经过时了老弟,代替他的新版本是jenkins/jenkins:lts,我们再某个版本以后就不再提供任何支持了,
好在这个jenkins/jenkins:lts是个链接,点击进去就是正在使用的文档地址啦;
文档地址是:github,https://github.com/jenkinsci/docker/blob/master/README.md
居然到了github,文档还是挺难找的,毕竟墙有点多
过期通知
DEPRECATION NOTICE
This image has been deprecated in favor of the
jenkins/jenkins:lts image provided and maintained by Jenkins Community
as part of project’s release process. The images found here will
receive no further updates after LTS 2.60.x. Please adjust your usage
accordingly.
那重新来一个search,pull吧,装个新版本的
pull之前把过期版本的镜像先删除了
[root@ecs-x-large-2-linux-20200317115657 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/gitlab/gitlab-ce latest 5f5beb0b3864 30 hours ago 1.89 GB
docker.io/mysql latest 9b51d9275906 13 days ago 547 MB
docker.io/tomcat latest 4e7840b49fad 2 weeks ago 529 MB
docker.io/jenkins latest cd14cecfdb3a 20 months ago 696 MB
[root@ecs-x-large-2-linux-20200317115657 ~]# docker rmi cd14cecfdb3a
正经的安装
[root@ecs-x-large-2-linux-20200317115657 ~]# docker search jenkins
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/jenkins Official Jenkins Docker image 4698 [OK]
docker.io docker.io/jenkins/jenkins The leading open source automation server 1954
docker.io docker.io/jenkinsci/blueocean https://jenkins.io/projects/blueocean 503
选择第二个
[root@ecs-x-large-2-linux-20200317115657 ~]# docker pull jenkins/jenkins
接下来怎么运行就得看文档啦
Usage
docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
我简单修改下,把主机的8080改为82,
docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
启动命令行会有一个
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
这个xxx是初始化的密码,记下来,或者在下面的地址可以找到
然后网页访问82端口
把刚才复制的密码放这个就ok啦
ps:如果不是这个界面就等一段时间,等待jenkins初始化完成,这个界面会自动刷新
刷新以后是个选择插件的界面,可以装推荐插件,自定义插件和跳过
我选的是安装推荐插件,会比较慢,也可以选择跳过,需要的时候再装
经过超级漫长的等待安装就完成啦
可以设置一个另外的管理员密码,之前保存的密码是admin用户的密码
跳过之后就可以部署项目进行测试啦
Jenkins构建和gitlab构建持续集成的测试
1.新建一个项目
输入名字,选择自由风格的项目
实际上我这里参考的是博客,博客地址我直接贴过来了
https://www.jianshu.com/p/5f671aca2b5a
如果博文有错误我会更新的