docker 搭建jenkins

1、拉取镜像

复制代码
docker pull jenkins/jenkins:2.416

2、创建文件夹

复制代码
mkdir -p /home/jenkins_mount
chmod 777 /home/jenkins_mount

3、运行并构建容器

复制代码
docker run --restart=always -d -p 10240:8080 -p 10241:50000 -v /home/jenkins_mount:/var/jenkins_home -v /etc/localtime:/etc/localtime --name myjenkins jenkins/jenkins:2.416

4、配置镜像加速,进入 cd /home/jenkins_mount/ 目录。

5、hudson.model.UpdateCenter.xml里的内容,将 url 修改为 清华大学官方镜像:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

http://mirror.esuni.jp/jenkins/updates/update-center.json(有效)

6、docker重启

7、 .管理员密码获取方法,编辑initialAdminPassword文件查看,把密码输入登录中的密码即可,开始使用。

8、http://localhost:10240/

注意:如果镜像拉不下来的话,修改/etc/docker下的daemon.json文件

复制代码
{
        "registry-mirrors": ["http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn","https://9cpn8tt6.mirror.aliyuncs.com"],
	"graph":"/home/docker"
}

9、重启docker

复制代码
systemctl restart  docker
相关推荐
JohnYan9 小时前
工作笔记 - CentOS7环境运行Bun应用
javascript·后端·容器
科大饭桶10 小时前
C++入门自学Day14-- Stack和Queue的自实现(适配器)
c语言·开发语言·数据结构·c++·容器
城管不管12 小时前
Docker核心---数据卷(堵门秘籍)
运维·docker·容器
BestAns13 小时前
Docker+Jenkins 自定义镜像指南
docker
Hello.Reader13 小时前
Elasticsearch Ruby 客户端安装与版本兼容指南
elasticsearch·jenkins·ruby
荔枝爱编程14 小时前
如何在 Docker 容器中使用 Arthas 监控 Java 应用
java·后端·docker
HONG_YANG14 小时前
2025 热门的 Web 化容器部署工具对比:Portainer VS Websoft9
docker
Peter·Pan爱编程16 小时前
Docker在Linux中安装与使用教程
linux·docker·eureka
cxyll123417 小时前
postman+newman+jenkins接口自动化
自动化·jenkins·postman
楠奕17 小时前
elasticsearch8.12.0安装分词
运维·jenkins