企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## Jenkins安装 - 拉取Jenkins镜像 ``` docker pull jenkins/jenkins ``` - 编写docker-compose.yml ```yml version: "3.1" services: jenkins: image: jenkins/jenkins container_name: jenkins ports: - 8080:8080 - 50000:50000 volumes: - ./data/:/var/jenkins_home/ ``` - 首次启动会因为数据卷data目录没有权限导致启动失败,设置data目录写权限 | 错误日志 | | :----------------------------------------------------------: | | ![](https://img.kancloud.cn/d1/22/d1222b4b6393b5d6d05cb9d960365075_1232x123.png)| ```sh chmod -R a+w data/ ``` - 重新启动Jenkins容器后,由于Jenkins需要下载大量内容,但是由于默认下载地址下载速度较慢,需要重新设置下载地址为国内镜像站 ```sh # 修改数据卷中的hudson.model.UpdateCenter.xml文件 <?xml version='1.1' encoding='UTF-8'?> <sites> <site> <id>default</id> <url>https://updates.jenkins.io/update-center.json</url> </site> </sites> # 将下载地址替换为http://mirror.esuni.jp/jenkins/updates/update-center.json <?xml version='1.1' encoding='UTF-8'?> <sites> <site> <id>default</id> <url>http://mirror.esuni.jp/jenkins/updates/update-center.json</url> </site> </sites> # 清华大学的插件源也可以https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json ``` - 再次重启Jenkins容器,访问Jenkins(需要稍微等会) | Jenkins首页 | | :----------------------------------------------------------: | |![](https://img.kancloud.cn/84/39/8439b5b9aadf303cf4ec2accfa5beeaf_1652x105.png)| | ![](https://img.kancloud.cn/0c/54/0c54df0a2aeba082251e23eb4e779a01_1920x605.png)| - 查看密码登录Jenkins,并登录下载插件 ```sh docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword ``` | 登录并下载插件 | | :----------------------------------------------------------: | |![](https://img.kancloud.cn/ef/c4/efc4ac8d3dfcc7dff81bbebcd0e9a799_1920x983.png) | |![](https://img.kancloud.cn/7a/8e/7a8eabb5ea3aad0242a0d0ad2edd6ae8_1920x776.png) | - 选择需要安装的插件 | 选择需要安装的插件 | | :----------------------------------------------------------: | | ![](https://img.kancloud.cn/ca/c4/cac4900e4bf3bf0b8d017f289757bc46_1872x533.png) | | ![](https://img.kancloud.cn/92/f7/92f7fc57b5a9e95b1902d6bd923d1841_1920x613.png)| | ![](https://img.kancloud.cn/89/f8/89f838b770799017e1cf10a558da36a5_1920x985.png)| - 下载完毕设置信息进入首页(可能会出现下载失败的插件) | | | ------------------------------------------------------------ | | ![](https://img.kancloud.cn/48/50/4850622e66da53b1e69ce8eddfe11273_1920x482.png) | | ![](https://img.kancloud.cn/e3/5c/e35c19aae434f36c4d0b1d271a9b3fa3_1920x436.png) | | ![](https://img.kancloud.cn/0d/20/0d2041fc803787a3f36aa2d819653f62_1920x1006.png) |