[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@localhost ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/dockerce/linux/centos/docker-ce.repo
[root@localhost ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d'
/etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum install docker-ce-20.10.* docker-cli-20.10.* -y
[root@localhost ~]# mkdir /etc/docker
[root@localhost ~]# vim /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"registry-mirrors": ["https://lc37ku91.mirror.aliyuncs.com"],
"max-concurrent-downloads": 10,
"max-concurrent-uploads": 5,
"log-opts": {
"max-size": "500m",
"max-file": "3"
},
"live-restore": true
}
创建 Jenkins 的数据目录,防止容器重启后数据丢失
[root@localhost ~]# mkdir /usr/local/jenkins_data -p
[root@localhost ~]# chmod -R 777 /usr/local/jenkins_data
安装Jenkins,并配置管理员账号密码为 admin / 123456
## 获取jenkins最新镜像 https://hub.docker.com/r/bitnami/jenkins/tags
[root@localhost ~]# docker run -d --name=jenkins --restart=always -e JENKINS_PASSWORD=123456 -e JENKINS_USERNAME=admin -e JENKINS_HTTP_PORT_NUMBER=8080 -p 8080:8080 -p 50000:50000 -v /usr/local/jenkins_data:/bitnami/jenkins bitnami/jenkins:2.346.2-debian-11-r5
其中 8080 端口为 Jenkins Web 界面的端口,50000 是 jnlp 使用的端口,后期 Jenkins Slave 需要使用 50000 端口和 Jenkins 主节点通信;
查看 Jenkins 日志
[root@localhost ~]# docker logs -f jenkins
Localization: Chinese (Simplified)
GitLab
Git Parameter
Git Pipeline for Blue Ocean
Blue Ocean
Common API for Blue Ocean
REST API for Blue Ocean
Web for Blue Ocean
Blue Ocean Core JS
JWT for Blue Ocean
Pipeline SCM API for Blue Ocean
Dashboard for Blue Ocean
GitHub Pipeline for Blue Ocean
Blue Ocean Pipeline Editor
Pipeline implementation for Blue Ocean
Build With Parameters
Dynamic Extended Choice Parameter
Extended Choice Parameter
List Git Branches Parameter
Delivery Pipeline
Pipeline: GitHub
Kubernetes
Kubernetes CLI
Image Tag Parameter
Active Choices
配置代理:
配置K8S集群:
旧版本 需要重启idea 新版本无需重启!!!
配置之前 先去生成 token:
拷贝这个token 然后去idea中配置:
可以愉快的在IDEA中构建打包编译部署了: