DEV Community

Cover image for Rancher 101 - Restoring Rancher (Docker)
Muhammad Abdur Rofi
Muhammad Abdur Rofi

Posted on

Rancher 101 - Restoring Rancher (Docker)

Restoring a Backup

Like making a backup, the process for restoring from a backup differs depending on how you made the backup. In both cases you're going to restore the backup tarball into a directory that will be made available to a new Rancher server container.

Docker Volume

When we make the backup, we did so from a data container and created a tarball. We now want to overwrite the contents of /var/lib/rancher in the Rancher container with the contents of the tarball.

  1. Move the tarball you want to restore onto the Rancher server and place it in /opt/backup
  2. Stop the Rancher container
  3. Make a fresh backup of the current state of the Rancher server container
  4. Run a temporary container that uses the volumes from the Rancher container and with a single command, remove the contents of /var/lib/rancher and then extract the tarball into it.
  5. Start the Rancher container

When the Rancher container starts up, it will use the restored contents of the backup.

Bind-Mounted Volume

If you used a bind-mounted volume such as /opt/rancher, then restoring from the backup is even easier.

  1. Move the tarball you want to restore onto the Rancher server and place it in /opt
  2. Stop the Rancher container
  3. Move /opt/rancher to /opt/rancher.bak
  4. Extract the tarball. This will create a new /opt/rancher
  5. Start the Rancher container

When the Rancher container starts up, it will use the restored contents of the backup.

References

Discussion (0)