Jenkins迁移数据目录

  1. 查看当前容器挂载的目录
bash 复制代码
[root@test-server01 ~]# docker inspect -f "{{.Mounts}}" jenkins
[{bind  /etc/localtime /etc/localtime   true rprivate} {bind  /opt/jenkins_data /var/jenkins_home   true rprivate}]
  1. 复制数据目录到数据盘
bash 复制代码
[root@test-server01 opt]# cp -r jenkins_data /home/
[root@test-server01 opt]# cd /home/
[root@test-server01 home]# ll
total 211472
-rw-r--r--  1 root    root    216535040 Mar  2  2024 centos.tar.gz
drwx------  3 git     git           129 Oct 30 05:10 git
drwx------  2 jenkins jenkins        62 Oct 22 10:53 jenkins
drwxr-xr-x 22 root    root         8192 Oct 30 16:15 jenkins_data
[root@test-server01 home]# chown -R jenkins.jenkins jenkins_data
#跨机器需要提前创建好Jenkins用户
[root@test-server01 home]# ll
total 211472
-rw-r--r--  1 root    root    216535040 Mar  2  2024 centos.tar.gz
drwx------  3 git     git           129 Oct 30 05:10 git
drwx------  2 jenkins jenkins        62 Oct 22 10:53 jenkins
drwxr-xr-x 22 jenkins jenkins      8192 Oct 30 16:15 jenkins_data
  1. 停掉当前Jenkins
bash 复制代码
[root@test-server01 home]# docker stop jenkins
jenkins
  1. 启动新容器
bash 复制代码
[root@test-server01 etc]# docker run -d --name jenkins_qy -p 8888:8080 -p 7777:50000  --privileged=true -v /home/jenkins_data:/var/jenkins_home -v /etc/localtime:/etc/localtime -v /etc/timezone:/etc/timezone jenkins/jenkins:latest
a248447cb4f874bbdcb02f2b34704bde5b696c5e782629b317f98328522ffc15
  1. 访问新的Jenkins网址


至此迁移成功了、原有数据还在。

相关推荐
一路随云000001 小时前
基于Unity YooAsset自动化资源管理框架,附源代码
运维·自动化
数数科技的数据干货2 小时前
从爆款到厂牌:解读游戏工业化的业务持续增长道路
运维·数据库·人工智能
深耕AI6 小时前
【完整教程】宝塔面板FTP配置与FileZilla连接服务器
运维·服务器
AI智域边界 - Alvin Cho8 小时前
Bloomberg、LSEG 与 MCP 缺口:为什么尚未发布完整的 MCP 服务器,以及多智能体系统如何解決这问题
运维·服务器
_OP_CHEN9 小时前
Linux网络编程:(七)Vim 编辑器完全指南:从入门到精通的全方位实战教程
linux·运维·服务器·编辑器·vim·linux生态·linux软件
Maple_land9 小时前
第1篇:Linux工具复盘上篇:yum与vim
linux·运维·服务器·c++·centos
shizhan_cloud9 小时前
Linux 硬盘分区管理
linux·运维
蓁蓁啊9 小时前
Ubuntu 虚拟机文件传输到 Windows的一种好玩的办法
linux·运维·windows·单片机·ubuntu
liao__ran10 小时前
ClickHouse CPU 排查快速参考指南
运维·服务器·clickhouse
liao__ran10 小时前
ClickHouse CPU 排查详细指南
运维·clickhouse