千家信息网

Docker安装Jenkins-2.249.3-1.1的过程是什么

发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,这篇文章主要讲解了"Docker安装Jenkins-2.249.3-1.1的过程是什么",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"Docker安装J
千家信息网最后更新 2025年01月20日Docker安装Jenkins-2.249.3-1.1的过程是什么

这篇文章主要讲解了"Docker安装Jenkins-2.249.3-1.1的过程是什么",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"Docker安装Jenkins-2.249.3-1.1的过程是什么"吧!

目录
  • 一、安装Docker

  • 二、拉取Jenkins镜像文件

  • 三、创建挂载目录并授权

  • 四、创建并启动Jenkins容器

  • 五、查看jenkins是否启动成功

  • 六、查看docker容器日志

  • 七、访问Jenkins

  • 八、安装Jenkins

一、安装Docker

#1.编写Docker安装脚本[root@ip-10-0-12-212 ~]# vim Ins_Docker.sh #!/usr/bin/bash# Author:jh# Time:2021-10-09  11:54:22# Name:Ins_Docker.sh# Version: 1.0# Discription: To  source /etc/init.d/functionsrely_software=(yum-utils device-mapper-persistent-data lvm2)echo "-----------------#1.检测系统内核版本-----------------"kernel_version=`uname -a |awk '{print $3}'|cut -d. -f1`[ $kernel_version -ge 3 ] &&  action "The System Install Docker is ..." /usr/bin/true || action "The System Can not Install Docker is ...";exit echo "-----------------#2.安装Docker依赖软件-----------------"for i in ${rely_software[*]}do           rpm -q $i &>/dev/null    if [ $? -eq 0 ];then        echo "$i is installed"                else                    yum -y install $i  &>/dev/null                                                                   action "$i is installing"  /usr/bin/true               fi                     doneecho "-----------------#3.添加Docker镜像源-----------------"yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo[ $? -eq 0 ] && action "Docker Image add is ..." /usr/bin/true || echo "Docker Image add is ..." /usr/bin/false;exitecho "-----------------#4.安装Docker-----------------"yum -y install docker-ce rpm -qa |grep docker-ce [ $? -eq 0 ] && action "Docker-ce is installed ..." /usr/bin/true || action "Docker-ce is install ..." /usr/bin/false;exitecho "-----------------#5.启动Docker并设置开机自启-----------------"systemctl enable --now docker[ $? -eq 0 ] && action "Docker Start is ...;" /usr/bin/true || action "Docker start is ..." /usr/bin/falsedocker_version=`docker -v |awk -F ',' '{print $1}'`echo "-----------------#6.设置Docker加速器-----------------"sudo mkdir -p /etc/dockersudo cat >/etc/docker/daemon.json <

二、拉取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 -d -p 10240:8080 -p 10241:50000 -v /data/jenkins_mount:/var/jenkins_home -v /etc/localtime:/etc/localtime --name Datalake_Jenkins jenkins/jenkinse0a9964d61fd5eb9f1c0eae0f2f18bdbfcd03ff0d5c2cc0d0beae31c134afa75

五、查看jenkins是否启动成功

[root@ip-10-0-12-212 ~]# docker psCONTAINER ID   IMAGE             COMMAND                  CREATED          STATUS          PORTS                                                                                        NAMESe0a9964d61fd   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_Jenkin

六、查看docker容器日志

[root@ip-10-0-12-212 ~]# docker logs Datalake_JenkinsRunning from: /usr/share/jenkins/jenkins.warwebroot: 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.JavaUtilLog2021-10-18 02:00:12.772+0000 [id=1]   INFO    winstone.Logger#logInternal: Beginning extraction from war file2021-10-18 02:00:14.184+0000 [id=1]   WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath2021-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+72021-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.JettyJspServlet2021-10-18 02:00:14.969+0000 [id=1]   INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node02021-10-18 02:00:14.969+0000 [id=1]   INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults2021-10-18 02:00:14.973+0000 [id=1]   INFO    o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms2021-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

八、安装Jenkins

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

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

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

#4.配置此处Jenkins的URL。

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

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

感谢各位的阅读,以上就是"Docker安装Jenkins-2.249.3-1.1的过程是什么"的内容了,经过本文的学习后,相信大家对Docker安装Jenkins-2.249.3-1.1的过程是什么这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!

0