What Happens During a Rancher 2.x Single Node Backup


Having read the sections about Rancher upgrades, backups, restorations and rollbacks of single node Rancher installations, I am still wondering how the data is stored. As per the description, snapshots / backups are generated by creating a new container that mounts the volumes of the previously stopped current Rancher container, as in:

docker create --volumes-from <RANCHER_CONTAINER_ID> \
--name rancher-backup-<RANCHER_VERSION> rancher/rancher:<RANCHER_CONTAINER_TAG>

As far as I understand, the content of the volumes is just shared, which means subsequent modifications of the content is also shared. How does the creation of the backup / snapshot container preserve (i.e. freeze) the state at the time of its creation? Is there some magic going on during container creation? As the container is not even run, it cannot do anything during its runtime (such as creating a copy or a tar archive of the content of the volume).

After creating the backup container, an inspection shows that bowh the original and the backup container bind-mount the same host directory at the same location:

    "Mounts": [
            "Type": "volume",
            "Name": "ffb2ccf9161cfd7a5c17114758a79a50b89188777ce9ad43663e7f1e3343ef0e",
            "Source": "/var/lib/docker/volumes/ffb2ccf9161cfd7a5c17114758a79a50b89188777ce9ad43663e7f1e3343ef0e/_data",
            "Destination": "/var/lib/rancher",
            "Driver": "local",
            "Mode": "",
            "RW": true,
            "Propagation": ""

In fact, the content of the “Mounts” section of the result of docker inspect is identical for both the original and the backup container.

1 Like

Hi again,

just to make things clear in case someone gets here from a search result: the documentation has been enhanced some time ago and suggests to create a tarball of the data in the data volume (or for HA setups an etcd backup) - see here:


Also, I have made good experiences with creating a snapshot of the VM rancher is running on before performing an upgrade (decide on your own whether this replaces or supplements the creation of a tarball).