How to "import" a container from a directory

I have a backup of /var/snap/lxd/common/lxd/containers/$CONTAINER copied to a backup server.

Now, I have set up a new LXD server and copied this $CONTAINER directory to this new LXD server - let’s say to /data/restore/$CONTAINER.

How can I “import” it and launch?

For example, this one gives me an error:

root@restore-test /data/restore/container # lxc import .
Error: Post "http://unix.socket/1.0/instances": read /var/lib/snapd/hostfs/data/restore/container: is a directory

You can use the lxd recover tool.

1 Like