Creating backups of LXC instances ensures that we can recover from events such as server crashes or corrupt backend stores. Backups also provide for a quick way of migrating instances between hosts or starting multiple similar containers, by just changing their config files.
In most use cases, we build containers from templates, or with tools such as debootstrap, which result in an entire root filesystem, for the instance. Creating backups in such cases is a matter of stopping the container, archiving its configuration file along with the actual root filesystem, then storing them on a remote server. Let's demonstrate this concept with a simple example:
Start by updating your Ubuntu distribution and installing LXC. For this example, we'll be using Ubuntu 16.04, but the instructions apply to any other Linux distribution:
root@ubuntu:~# apt-get update && apt-get -y upgrade && reboot root@ubuntu...