Separate Swarm into 2 swarms


We have a single swarm with nodes on two datacenter running several containers and has been working fine, but recently got a requirement to separate the swarm into one per each datacenter.

I can remove one of the nodes from the swarm and create the new swarm there with docker swarm init. Now the question is: Is there any way I can clone the swarm1 config to config 2, so the containers are there instead of re-deploying all containers on the new swarm?

Really appreciate all the assistance can be provided on this matter.


Lets assume for a minute you only work with local named folumes and backup the /var/lib/docker folder (which would be the most optimal scenario!), I still highly doubt the backup would retain all “virtual folders” that overlayfs creats, so following this approach seems not like a clean solution to me.

It is better to backup the volumes, and recreate everything on the other side. Since downtime will be inevitable for this action, what’s wrong with using a clean approach?

@meyay thanks for the reply.

I was looking into split the swarm because our deplyment process is very manual and wanted to avoid the tedious task of deploy all containers also looking for low down time. But after some considerations we are going to be implementing a separate swarm and re-deploying everything.