A few months ago, I was looking for a best way to migrate LXD containers between nodes. Low downtime was the main criterion.
Live migration,based on documentation, can only be done through СRIU, but this technology works very bad.
Therefore, the following method was chosen:
create an empty LXD container on the destination node;
rsync container files from source node to destination (without turning off the container);
import container on the destination server with lxd import (in order to import container’s configs);
stop container on source node;
one more rsync of container files;
start container on destination node.
This scheme worked fine, but in LXD 4.17, the lxd import command was removed, and the lxd recover added instead, but it doesn’t have a similar non-interactive functionality.
Tell me, please, is there any other method for exporting and then importing container configs?
Or are there other ways to migrate containers with little downtime?
@stgraber I read the documentation about lxd-p2c, as I understand it, this application will help us create a container on a destination server and synchronize files, but it does not solve the issue of transferring configs. With lxd-p2c we need to set container’s config params manually.
Is there any possibility to export only config of LXD container (without files) on one server and import this config to LXD container on another server?
If you’re copy LXD to LXD, why aren’t you just using lxc copy?
You can run it on running containers with --stateless and can even run --refresh to update the remote copy after you’ve done an initial pass, so for minimal downtime, something like: