安装
admin@ubuntu20:~$ docker pull jenkins/jenkins:lts
- 启动镜像,端口8282映射到docker的8080,挂载本地目录
admin@ubuntu20:~/jenkins$ docker run -p 8282:8080 --name myjenkins -d -v /home/admin/jenkins:/var/jenkins_home/ jenkins/jenkins:lts
admin@ubuntu20:~/jenkins$ docker exec -it myjenkins bash
jenkins@1bdd06a236b1:/$ cd /var/jenkins_home/
jenkins@1bdd06a236b1:~$ ls -l
total 60
-rw-r--r-- 1 jenkins jenkins 1659 Apr 1 23:37 config.xml
-rw-r--r-- 1 jenkins jenkins 50 Apr 1 23:37 copy_reference_file.log
-rw-r--r-- 1 jenkins jenkins 29 Apr 1 23:37 failed-boot-attempts.txt
-rw-r--r-- 1 jenkins jenkins 156 Apr 1 23:37 hudson.model.UpdateCenter.xml
-rw------- 1 jenkins jenkins 1712 Apr 1 23:37 identity.key.enc
-rw-r--r-- 1 jenkins jenkins 171 Apr 1 23:37 jenkins.telemetry.Correlator.xml
drwxr-xr-x 2 jenkins jenkins 4096 Apr 1 23:37 jobs
-rw-r--r-- 1 jenkins jenkins 907 Apr 1 23:37 nodeMonitors.xml
drwxr-xr-x 2 jenkins jenkins 4096 Apr 1 23:37 nodes
drwxr-xr-x 2 jenkins jenkins 4096 Apr 1 23:37 plugins
-rw-r--r-- 1 jenkins jenkins 64 Apr 1 23:37 secret.key
-rw-r--r-- 1 jenkins jenkins 0 Apr 1 23:37 secret.key.not-so-secret
drwx------ 2 jenkins jenkins 4096 Apr 1 23:37 secrets
drwxr-xr-x 2 jenkins jenkins 4096 Apr 1 23:37 userContent
drwxr-xr-x 3 jenkins jenkins 4096 Apr 1 23:37 users
drwxr-xr-x 11 jenkins jenkins 4096 Apr 1 23:37 war
jenkins@1bdd06a236b1:~$ sed -i 's/http:\/\/updates.jenkinsci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' updates/default.json
jenkins@1bdd06a236b1:~$ sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' updates/default.json
jenkins@1bdd06a236b1:~$
Web配置
- 打开web http://[your-ip]:8282
- 按照Web提示一步一步来就可以了