Docker搭建Jenkins集成环境

1. 创建安装文件夹

mkdir /home/jenkins

2. 添加权限

chown -R 1000 /home/jenkins/

3. 执行以下操作

docker run -d --name jenkins -p 8080:8080 -v /home/jenkins:/home/jenkins jenkins/jenkins:lts

也可以分开

[root@lucky ~]# docker pull jenkins/jenkins:lts
lts: Pulling from jenkins/jenkins
3192219afd04: Pull complete
17c160265e75: Pull complete
cc4fe40d0e61: Pull complete
9d647f502a07: Pull complete
d108b8c498aa: Pull complete
1bfe918b8aa5: Pull complete
dafa1a7c0751: Pull complete
778e8430be10: Pull complete
f691085434e7: Pull complete
c773ad417853: Pull complete
588c47e03ebf: Pull complete
188896fc235c: Pull complete
531c409665fe: Pull complete
7d45f079f587: Pull complete
bf743b158a31: Pull complete
8dcb6fcd107c: Pull complete
485a955ebd4a: Pull complete
822b6d40c0ee: Pull complete
36b4ce80355f: Pull complete
Digest: sha256:0e8912b04f962b258ff9f51fb85fd1a9c5458e9d6e2f84aee747d765de0b7b70
Status: Downloaded newer image for jenkins/jenkins:lts
docker.io/jenkins/jenkins:lts
[root@lucky ~]# docker images
[root@lucky ~]# docker run -d --name jenkins -p 8080:8080 -v /home/jenkins:/home/jenkins jenkins/jenkins:lts
05fec316cd782d2a5af78dd8072632787f7421071dc19eccdf78ed35561c

4.查看jenkins 服务

docker ps | grep jenkins
[root@lucky ~]# curl 0.0.0.0:8080

5. 查看密码,打开浏览器进入设置管理员密码:

[root@lucky ~]# docker exec -it jenkins bash
jenkins@05fec316cd78:/$ cat /var/jenkins_home/secrets/initialAdminPassword
c4336b9b8d564e4286b07

Docker搭建Jenkins集成环境_第1张图片

6. 重启jenkins

docker restart jenkins

7. 将管理员密码填入后安装完成

8. 阿里云设置安全组

Docker搭建Jenkins集成环境_第2张图片

一般选择推荐的插件

Docker搭建Jenkins集成环境_第3张图片
安装插件的过程会比较慢

你可能感兴趣的:(Devops,#,Docker)