在Docker中创建Jenkins的卷备份[Linux] [英] Create volume backup of Jenkins in Docker [Linux]

查看:110
本文介绍了在Docker中创建Jenkins的卷备份[Linux]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Docker中安装了Jenkins,我需要创建备份并在需要时还原它们. 我尝试了一些插件,但是因为我使用的是docker,所以它们无法工作.除此之外,我还需要备份所有内容,包括历史数据.

I have a Jenkins installation in Docker and I need to create backups and restore them when I need. I tried some plugins but because I'm using docker they don't work. Besides that, I need to backup everything including historic.

我偶然发现了此页面:

I stumbled on this page: https://medium.com/pacroy/how-to-backup-and-restore-your-jenkins-data-volume-in-docker-2ac66d99315a

但是说明是针对Windows的,我无法使其适应我的linux环境.

but the instructions are for windows and I can't adapt that to my linux environment.

我的问题是:如何在docker中创建我的jenkins实例的完整备份,以使其可以还原甚至在另一台机器上创建副本.

My question is: how can I create full backups of my jenkins instance in docker in a way that I can restore it or even create a copy in another machine.

谢谢.

推荐答案

所有Jenkins数据(包括作业配置和内部版本)都存储在容器内的/var/jenkins_home下.

All the Jenkins data including job configuration and builds are stored under /var/jenkins_home inside the container.

因此,您可以简单地备份此文件夹,所有Jenkins状态将保持不变.您可以使用以下方法定期从容器中复制此文件夹:

Thus you can simply backup this folder and all the Jenkins state will be persisted. You can regularly copy this folder from the container using:

docker cp <jenkins-container-name>:/var/jenkins_home ./jenkins_home

从这些备份中的任何一个中,您都可以使用以下命令启动新的jenkins实例:

You from anyone of these backup you can start a new jenkins instance using the command:

docker run -v ./jenkins_volume:/var/jenkins_home -p 8080:8080 jenkins ...

这篇关于在Docker中创建Jenkins的卷备份[Linux]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆