拉取鏡像
root@EricZhou-MateBookProX: docker pull jenkins/jenkins:lts
lts: Pulling from jenkins/jenkins
3192219afd04: Pull complete
17c160265e75: Pull complete
cc4fe40d0e61: Pull complete
9d647f502a07: Extracting [===================================> ] 35.65MB/50.07MB
d108b8c498aa: Download complete
1bfe918b8aa5: Download complete
dafa1a7c0751: Downloading [=================> ] 36.8MB/104.2MB
9221a8ef4852: Downloading [===> ] 3.116MB/44.27MB
a79e75dd432b: Download complete
efbc20726efc: Downloading
創(chuàng)建數(shù)據(jù)卷目錄
docker run 容器
docker run -d --name jenkins -p 7000:80 -v /home/jenkins:/home/jenkins jenkins/jenkins:lts
查看jenkins容器,status值為UP
root@EricZhou-MateBookProX: docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
29c2a14856be jenkins/jenkins:lts "/sbin/tini -- /usr/…" 22 seconds ago Up 21 seconds 8080/tcp, 50000/tcp, 0.0.0.0:7000->80/tcp jenkins
瀏覽器輸入localhost:7000,訪問以下頁面
進(jìn)入容器,獲取密碼,輸入即可
# 進(jìn)入容器
root@EricZhou-MateBookProX: docker exec -it jenkins bash
# 獲取密碼
jenkins@2fdf047094f6:/$ cat /var/jenkins_home/secrets/initialAdminPassword
1c45086eac3043feade3e816a306cf5b
安裝推薦的插件,等待安裝過程,服務(wù)搭建完畢
以上就是docker搭建jenkins服務(wù)的示例的詳細(xì)內(nèi)容,更多關(guān)于docker搭建jenkins服務(wù)的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!