简体   繁体   English

如何版本控制 Docker 容器的数据量?

[英]How to version control Docker containers' data volumes?

I want to run Jenkins in a docker container, and according to my understanding of this thread the best practice for managing the container's data is to use docker's new volume API (so I can update the Jenkins container without losing my data)我想在 docker 容器中运行 Jenkins,根据我对这个线程的理解,管理容器数据的最佳实践是使用 docker 的新卷 API (这样我就可以在不丢失数据的情况下更新 Jenkins 容器)

My concern is losing the data somehow, so I want to store it using a version control system, eg Git.我担心会以某种方式丢失数据,所以我想使用版本控制系统(例如 Git)来存储它。 That way I can track the changes done in my team's build and get things working again if someone makes a mess.这样我就可以跟踪在我的团队构建中所做的更改,并在有人搞砸时让事情重新开始工作。

The issue that is not clear to me is how to version control the data?我不清楚的问题是如何对数据进行版本控制? Also, I want to be able to get my container running with restored data in a flash (a simple script/command)此外,我希望能够让我的容器在闪存中运行恢复的数据(一个简单的脚本/命令)

Note that the version control system is not the issue here, I am looking for a best practice for working with containers' data(volumes) in a way that allows tracking changes and restoring the "system" quickly if something breaks.请注意,版本控制系统不是这里的问题,我正在寻找一种最佳实践,以允许跟踪更改并在出现问题时快速恢复“系统”的方式处理容器的数据(卷)。

We don't version control the setting, and just directly backup the whole folder /var/lib/jenkins to s3 bucket every hour.我们不对设置进行版本控制,只是每小时直接将整个文件夹/var/lib/jenkins到 s3 存储桶。

In S3 bucket, you can active version control, or set rotate policy, for example, keep the data in 90 days only.在 S3 存储桶中,您可以激活版本控制,或设置轮换策略,例如,仅将数据保留 90 天。

restore is easier, after install jenkins, copy the data backup to /var/lib/jenkins , you get everything back.恢复更容易,安装 jenkins 后,将数据备份复制到/var/lib/jenkins ,您将恢复所有内容。

So should be fine to do the same with traditional backup plan, if no access to aws s3 bucket因此,如果无法访问 aws s3 存储桶,则对传统备份计划执行相同操作应该没问题

I suggest investigating the use of volume plugins .我建议调查音量插件的使用。 Some of thesesupport snapshotting the file system, a feature that can later be used for PITR (Point in time recovery)其中一些支持对文件系统进行快照,该功能稍后可用于 PITR(时间点恢复)

Complementing Mark O'Connor's answer. 补充马克·奥康纳(Mark O'Connor)的答案。 Following vol plugin appears promising. 以下vol插件似乎很有希望。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM