今天咱們來學習 docker 如何快速安裝 jenkins 和禪道系統。html
若是大家尚未用禪道或其餘管理工具,強烈推薦下趕忙 docker 安裝禪道就用用起來吧web
一、首先要安裝了 docker,可參考:http://www.javashuo.com/article/p-eruqaqkr-mo.htmldocker
二、首先建立掛載目錄:jenkins,而且給與權限(否則起不來別怪我):json
# 更改目錄權限:給uid爲1000的權限 [root@iZbp19lugf22zbsubsf1y6Z ~]# mkdir ~/jenkins [root@iZbp19lugf22zbsubsf1y6Z ~]# chown -R 1000:1000 ~/jenkins
而後一條命令完事(只需等待下載的時間):瀏覽器
docker run -itd -p 3006:8080 -p 50000:50000 -v ~/jenkins:/var/jenkins_home -e JAVA_OPTS=-Duser.timezone=Asia/Shanghai --name jenkins jenkinsci/blueocean
三、運行結果以下:bash
[root@iZbp19lugf22zbsubsf1y6Z ~]# docker run -itd -p 3006:8080 -p 50000:50000 -v ~/jenkins:/var/jenkins_home -e JAVA_OPTS=-Duser.timezone=Asia/Shanghai --name jenkins jenkinsci/blueocean Unable to find image 'jenkinsci/blueocean:latest' locally latest: Pulling from jenkinsci/blueocean e7c96db7181b: Pull complete f910a506b6cb: Pull complete c2274a1a0e27: Pull complete fb11157cad2d: Pull complete 671d4a1cbe1a: Pull complete 09edd91768a5: Pull complete debb14ec40c1: Pull complete 480a5bd152f8: Pull complete cb72d6a92334: Pull complete 757db70f71a1: Pull complete 0128fdd173b0: Pull complete 9610f4e0da3f: Pull complete 210df9d82fb2: Pull complete 22f95a9fa254: Pull complete b34b4d5b5bcb: Pull complete Digest: sha256:af91aea57ac78588d281b1af34905734cdb6ebbb8dc28b8519d1dc95bad87b07 Status: Downloaded newer image for jenkinsci/blueocean:latest fa81928c4dcef3bcda052b7ae50f5ddec90445d2e849dd648e86b384b8a12bad
四、ip + 端口 在web訪問(首次啓動須要等待jenkins緩衝時間)tcp
五、會提示須要輸入密碼,咱們根據目錄運行一下拿到密碼 cat 目錄,輸入下一步便可。工具
[root@iZbp19lugf22zbsubsf1y6Z ~]# docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword 7dd3a0c99c2c4bea939971e636d1eb47 [root@iZbp19lugf22zbsubsf1y6Z ~]#
六、安裝推薦插件,這裏強烈推薦一波更改jenkins配置文件,今後插件安裝不到1分鐘全完善好了oop
①查看容器:docker ps 學習
[root@iZbp19lugf22zbsubsf1y6Z ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d3db015c44a6 jenkins/jenkins:lts "/sbin/tini -- /usr/…" 5 minutes ago Up 5 minutes 0.0.0.0:50000->50000/tcp, 0.0.0.0:3006->8080/tcp jenkins
②進入容器bash:docker exec -it 容器id /bin/bash
[root@iZbp19lugf22zbsubsf1y6Z ~]# docker exec -it jenkins /bin/bash
jenkins@d3db015c44a6:/$
③ cd 到 updates 目錄下:執行這一句便可修改配置文件,路徑是:/var/jenkins_home/updates/default.json
jenkins@dc8eac41938b:/$ cd /var/jenkins_home/updates/ jenkins@dc8eac41938b:~/updates$ sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json && sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json jenkins@dc8eac41938b:~/updates$
④ exit 回來,接着重啓jenkins輸入:docker restart jenkins,從新打開jenkins web,選擇推薦安裝的插件,會發現非通常的速度給您安裝好了。
七、(插件安裝太慢,確定是您沒有重啓jenkins)完善信息,點擊下一步、下一步這樣就大功告成了。
一、前面也講過 docker 安裝,只須要一條命令回車就完事了:
docker run -d -p 8888:80 -p 3386:3306 -e USER="admin" -e PASSWD="123456" -e BIND_ADDRESS="false" -e SMTP_HOST="163.177.90.125 smtp.exmail.qq.com" -v /data/zbox/:/opt/zbox/ --name zentao-server idoop/zentao:latest
運行結果:
[root@iZbp19lugf22zbsubsf1y6Z ~]# docker run -itd -p 8888:80 -p 3316:3306 -e USER="admin" -e PASSWD="123456" -e BIND_ADDRESS="false" -e SMTP_HOST="163.177.90.125 smtp.exmail.qq.com" -v /data/zbox/:/opt/zbox/ --name zentao idoop/zentao:latest Unable to find image 'idoop/zentao:latest' locally latest: Pulling from idoop/zentao 7ddbc47eeb70: Pull complete c1bbdc448b72: Pull complete 8c3b70e39044: Pull complete 45d437916d57: Pull complete 750e6c6007ed: Pull complete c1a7f7e493d0: Pull complete ddcf1757dffa: Pull complete 988f5ca0317c: Pull complete ec88538220d9: Pull complete Digest: sha256:3355b9e6a0d5fa50552b10ed82517cc058ed7fc6e96d1a0edab333c842003ac4 Status: Downloaded newer image for idoop/zentao:latest aba48aac1f2d1c15f4456c62fdc871e65652e7c4d421b2b3bace9c1f08e3330a [root@iZbp19lugf22zbsubsf1y6Z ~]#
二、查看運行容器:docker ps
[root@iZbp19lugf22zbsubsf1y6Z ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES aba48aac1f2d idoop/zentao:latest "docker-entrypoint" 9 minutes ago Up 8 minutes (healthy) 0.0.0.0:8888->80/tcp, 0.0.0.0:3316->3306/tcp zentao
三、瀏覽器打開:ip + 端口
jenkins 如需漢化中文版參考這篇文章:http://www.javashuo.com/article/p-zdamqwgs-gc.html
歡迎來QQ交流羣:482713805