简体   繁体   English

如何备份docker swarm模式服务配置以进行灾难恢复

[英]How to back up docker swarm mode service configuration for disaster recovery

I have a number of servers running as a swarm using docker swarm mode. 我有许多使用docker swarm模式作为swarm运行的服务器。 There are several (5+) stacks running in the swarm each with their respective docker-compose.yml files. 在swarm中运行了几个(5+)堆栈,每个堆栈都有各自的docker-compose.yml文件。

I am mainly using docker stack deploy to manage my stacks (editing my docker-compose.yml then running deploy so that the compose files remain a true reflection of the running configuration). 我主要使用docker stack deploy来管理我的堆栈(编辑我的docker-compose.yml然后运行deploy,这样compose文件仍然是运行配置的真实反映)。 The down-side of this is that any changes I make directly to a service are lost on the next deploy , and it prevents me from using tools like portainer to their full potential. 不言而喻的是,我直接对服务所做的任何更改都会在下次部署时丢失,这使我无法充分利用portainer等工具。

In an ideal world I would like to be able to export my entire running configuration to a collection of docker-compose.yml files allowing me to manage any divergence between the running config and my current config. 在理想的世界中,我希望能够将我的整个运行配置导出到docker-compose.yml文件的集合中,从而允许我管理正在运行的配置和当前配置之间的任何差异。

I can see that I could roll something of my own using some shell scripting, docker inspect -f and some go templates, but I would have to maintain this all myself. 我可以看到我可以使用一些shell脚本, docker inspect -f和一些go模板来滚动我自己的东西,但我必须自己维护这一切。

Are there tools or libraries out there to support my use case? 是否有工具或库来支持我的用例?

The docker-compose.yaml file is part of your application, and should be kept in source control, following the "Infrastructure as code" logic. docker-compose.yaml文件是应用程序的一部分,应按照“基础结构为代码”逻辑保存在源代码管理中。

However, at DockerCon 19, "Server side stack" support for Swarm was just announced. 然而,在DockerCon 19上,刚刚公布了对Swarm的“服务器端堆栈”支持。 So you'll have an working solution in a few weeks or months. 因此,您将在几周或几个月内获得可行的解决方案。

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

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