Docker Swarm Backup and Restore

If you are managing a swarm cluster, it is important to be able to backup current swarm data and restore a previous backup. In this lesson, we will demonstrate the process of performing a simple backup and restore in a swarm cluster.
Relevant Documentation

https://docs.docker.com/engine/swarm/admin_guide/#back-up-the-swarm

– Create the Backup

– On the manager:

sudo systemctl stop docker
sudo tar -zvcf backup.tar.gz -C /var/lib/docker/swarm .
sudo systemctl start docker

– Restore from Backup

– On the manager:

sudo systemctl stop docker
sudo rm -rf /var/lib/docker/swarm/*
sudo tar -zxvf backup.tar.gz -C /var/lib/docker/swarm/
sudo systemctl start docker
docker node ls

No token or token has expired.