第二十七章 Centos7下Docker安装Jenkins

一、拉取Jenkins镜像文件

[root@ip-10-0-12-212 ~]# docker pull jenkins/jenkins

二、创建挂载目录并授权

[root@ip-10-0-12-212 ~]# mkdir -p /data/jenkins_mount
[root@ip-10-0-12-212 ~]# chmod  777 /data/jenkins_mount

三、创建并启动Jenkins容器

[root@ip-10-0-12-212 ~]# docker run \
-itd \
-p 10240:8080 \
-p 10241:50000 \
-v /data/jenkins_mount:/var/jenkins_home \
-v /etc/localtime:/etc/localtime \
--restart always \
--privileged=true \
--name Datalake_Jenkins \
jenkins/jenkins

四、查看jenkins是否启动成功

[root@ip-10-0-12-212 ~]# docker ps
CONTAINER ID   IMAGE             COMMAND                  CREATED          STATUS          PORTS                                                                                        NAMES
e0a9964d61fd   jenkins/jenkins   "/sbin/tini -- /usr/…"   13 seconds ago   Up 12 seconds   0.0.0.0:10240->8080/tcp, :::10240->8080/tcp, 0.0.0.0:10241->50000/tcp, :::10241->50000/tcp   Datalake_Jenkins

五、查看docker容器日志

[root@ip-10-0-12-212 ~]# docker logs Datalake_Jenkins
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
2021-10-18 02:00:12.630+0000 [id=1]	INFO	org.eclipse.jetty.util.log.Log#initialized: Logging initialized @1247ms to org.eclipse.jetty.util.log.JavaUtilLog
2021-10-18 02:00:12.772+0000 [id=1]	INFO	winstone.Logger#logInternal: Beginning extraction from war file
2021-10-18 02:00:14.184+0000 [id=1]	WARNING	o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2021-10-18 02:00:14.319+0000 [id=1]	INFO	org.eclipse.jetty.server.Server#doStart: jetty-9.4.43.v20210629; built: 2021-06-30T11:07:22.254Z; git: 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8; jvm 11.0.12+7
2021-10-18 02:00:14.887+0000 [id=1]	INFO	o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2021-10-18 02:00:14.969+0000 [id=1]	INFO	o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2021-10-18 02:00:14.969+0000 [id=1]	INFO	o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2021-10-18 02:00:14.973+0000 [id=1]	INFO	o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms
2021-10-18 02:00:15.909+0000 [id=1]	INFO	hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2021-10-18 02:00:16.516+0000 [id=1]	INFO	o.e.j.s.handler.ContextHandler#doStart: Started w.@316a598d{Jenkins v2.316,/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
2021-10-18 02:00:16.586+0000 [id=1]	INFO	o.e.j.server.AbstractConnector#doStart: Started ServerConnector@505a9d7c{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}

六、访问Jenkins

访问Jenkins页面,http://52.82.80.128:10240

image

七、安装Jenkins

[root@ip-10-0-12-212 ~]# cd /data/jenkins_mount/
[root@ip-10-0-12-212 jenkins_mount]# cat secrets/initialAdminPassword 
67925445271c4fe593ba83eede0f9c75

image

#2.选择安装推荐的插件

image

#3.填入相应的管理用户信息,点击保存并完成。

image

#4.配置此处Jenkins的URL。

image

#5.此处Jenkins已经安装就绪,点击开始使用Jenkins。

image

#6.此处已经进入Jenkins页面,右下角显示安装的版本号,至此Jenkins安装完毕。

image

posted @ 2022-01-14 14:34  年少纵马且长歌  阅读(247)  评论(0编辑  收藏  举报