Backup and restore Docker persistent volumes

There are a number of prerequisites that must be fulfilled before you backup and restore your Docker persistent volumes.

  • VSphere clusters should have access to a datastore specifically for backups. This is a separate Virtual Volume created on the HPE 3PAR StoreServ and presented to all the hosts in the vSphere cluster.
  • Backup software must be available. HPE Recovery Manager Central and HPE 3PAR StoreServ is recommended but other customer backup and restore solutions are acceptable.

A number of restrictions also apply:

  • Volumes may not be in use when a volume is cloned. Any container that has the volume attached must be paused prior to creating the clone. The container can be resumed once the clone is complete.
  • When Docker volumes need to be restored from backup, the backup datastore needs to be detached from all vSphere cluster servers prior to restoration.

Persistent storage backup solution

Creating the volume

Docker persistent volumes can be created from a worker node using the following command:

docker volume create --driver=vsphere --name=MyVolume@MyDatastore -o size=10gb 

Cloning the volume

Note: Prior to creating a clone of a volume, any containers accessing the volume should be paused or stopped.

Docker volumes can be cloned to a new datastore:

docker volume create --driver=vsphere --name=CloneVolumme@DockerBackup -o clone-from=MyVolume@MyDatastore -o access=read-only 

Snapshot and back up HPE 3PAR Virtual Volumes with HPE Recovery Manager Central and HPE StoreOnce

HPE Recovery Manager Central (RMC) software integrates HPE 3PAR StoreServ All-Flash arrays with HPE StoreOnce Systems to leverage the performance of snapshots with the protection of backups. RMC uses a direct backup model to orchestrate data protection between the array and the backup system without a backup application. When the first full backup is complete, each subsequent backup is incremental, making it significantly faster than traditional backup methods, particularly for higher volumes of data. Backups to HPE StoreOnce are block-level copies of volumes, de-duplicated to save space. Because RMC snapshots are self-contained, fully independent volumes, they can be restored to any HPE 3PAR array in the event of a disaster. See the figure below for an overview of the architecture.

HPE Recovery Manager Central enables you to replicate data from the source storage system (HPE 3PAR StoreServ) to the destination storage system (HPE StoreOnce). The replication is based on point-in-time snapshots. HPE Recovery Manager Central is installed as a VM on VMware vSphere ESXi. It can be installed on the HPE Synergy platform on a separate (from the Docker Solution) vSphere cluster or external to the Synergy environment as long as the external server has connectivity to the HPE 3PAR StoreServ and HPE StoreOnce. HPE RMC can be installed directly on an ESXi host or can be deployed to a VMware vCenter managed environment. For this solution, the standalone "RMC only" is installed. If HPE RMC is installed in the HPE Synergy environment, iSCSI connection to the HPE 3PAR StoreServ is required.

Figure. HPE Recovery Manger Central and HPE StoreOnce

  • The connectivity between HPE 3PAR StoreServ and HPE RMC for data traffic is over iSCSI.
  • The connectivity between HPE StoreOnce and HPE RMC is over CoEthernet (Catalyst OverEthernet)
  • The connectivity between HPE RMC, HPE 3PAR StoreServ, and HPE StoreOnce for management traffic is over IP.

The following figure illustrates the connectivity between various components.

Figure. Connectivity

Integrate UCP and DTR backup with HPE RMC and HPE StoreOnce

You can take advantage of HPE Recovery Manager Central and HPE StoreOnce to provide scheduled snapshots and backup protection for the data generated by the backup procedure for Docker UCP and DTR.

  1. Create a datastore from the Backup virtual volume you created and present it to all hosts in the vSphere cluster. This backup datastore is used for storing copies of Docker persistent volumes as well as backups of DTR and UCP.

  2. The Ansible server is used to create backup and restore files for DTR and UCP on the local hard drive. The backup files should be copied to the DockerBackups datastore which can be automatically configured for snapshots and offsite backup.

  3. Edit the Ansible server configuration from vCenter. Add a new hard disk and specify the location as the Docker Backup datastore as shown in the following figure.

    Figure. Add new hard disk

  4. After the hard disk is added, it is visible from the Linux operating system. From the Ansible server:

# ls /dev/sd*
  1. The newly added storage should appear as /dev/sdb. Now, make a filesystem, ignoring any warnings:
# mkfs -t ext4 /dev/sdb 
  1. Create a mount point for the new disk:
# mkdir /dockerbackup
  1. Edit the /etc/fstab file and add the following line:
/dev/sdb /dockerbackup ext4 defaults 0  0
  1. After saving the change, mount the new volume using:
# mount -a

Each time you backup Docker UCP and DTR using the backup.sh script, you should copy the generated files from the /root/backups folder to /dockerbackup. You may wish to add a command to the backup script to automate this process. The virtual volume used to host the DockerBackup datastore can be scheduled for snapshot and backup protection with HPE Recovery Manager Central and HPE StoreOnce as described in the section Backup and restore Docker persistent volumes. Data backed up to HPE StoreOnce can be restored to the HPE 3PAR StoreServ and attached to the Ansible host for recovery.