您好,登錄后才能下訂單哦!
這篇文章主要講解了“Docker安裝Jenkins-2.249.3-1.1的過程是什么”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“Docker安裝Jenkins-2.249.3-1.1的過程是什么”吧!
一、安裝Docker
二、拉取Jenkins鏡像文件
三、創建掛載目錄并授權
四、創建并啟動Jenkins容器
五、查看jenkins是否啟動成功
六、查看docker容器日志
七、訪問Jenkins
八、安裝Jenkins
#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/functions rely_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 done echo "-----------------#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;exit echo "-----------------#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;exit echo "-----------------#5.啟動Docker并設置開機自啟-----------------" systemctl enable --now docker [ $? -eq 0 ] && action "Docker Start is ...;" /usr/bin/true || action "Docker start is ..." /usr/bin/false docker_version=`docker -v |awk -F ',' '{print $1}'` echo "-----------------#6.設置Docker加速器-----------------" sudo mkdir -p /etc/docker sudo cat >/etc/docker/daemon.json <<EOF { "registry-mirrors": ["https://8mh75mhz.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker echo "-----------------#7.查看Docker是否安裝完成-----------------" cat << EOF +-------------------------------------------------+ | $docker_version 安 裝 已 完 成 | | 請 使 用 相 關 服 務 ! | +-------------------------------------------------+ EOF echo "-----------------#8.遷移Docker根目錄-----------------" systemctl stop docker mv /var/lib/docker/ /data/ sed -i 's#ExecStart=/usr/bin/dockerd#ExecStart=/usr/bin/dockerd --graph=/data/docker#g' /usr/lib/systemd/system/docker.service systemctl daemon-reload systemctl start docker.service echo "-----------------#9.驗證Docker根目錄是否生效-----------------" docker info |grep "Docker Root Dir" sleep 5 echo ""-----------------你的小可愛已完成Docker全部部署-----------------" #2.給腳本添加執行權限 [root@ip-10-0-12-212 ~]# chmod +x Ins_Docker.sh #3.執行腳本 [root@ip-10-0-12-212 ~]# sh Ins_Docker.sh
[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
[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/jenkins e0a9964d61fd5eb9f1c0eae0f2f18bdbfcd03ff0d5c2cc0d0beae31c134afa75
[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_Jenkin
[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頁面,http://52.82.80.128:10240
[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的過程是什么這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。