How to backup and restore LXD containers

Originally published at: https://www.cyberciti.biz/faq/how-to-backup-and-restore-lxd-containers/

LXD backup and restore
Now that I set up an LXD container, how do I backup and restore LXD containers running on Ubuntu/Debian or Fedora/CentOS Linux server?