Move LXC container to new VM
Create snapshot on your current VM
lxc snapshot container_name snapshot_name
Validate created snapshot by checking the snapshots list displayed with:
lxc info container_name
In case you have not named your snapshot, look for the most recent creation date. It might have a default name like snap1
.
Create an image from the snapshot
lxc publish container_name/snapshot_name --alias="image_alias" description="image_description"
Verify your created image by checking the image list displayed with:
lxc image info image_alias
Export the created image to an archive in your current path
lxc image export image_alias image_archive_name
Send the file to your new VM
Make sure, that you can establish an SSH connection to your new VM from your old VM, e.g. by a VPN or Wireguard connection. Use scp to copy the image like so:
scp ./image_archive_name.tar.gz usera@host:/home/user
Import image and launch new container on your new VM
Make sure lxc and lxd are installed on your new VM and then import the image like so:
lxc image import image_archive_name.tar.gz --alias image_alias_on_new_vm
Make sure the imported image appears in the list on your new VM.
lxc image list
Then launch a new container from the image with:
lxc launch image_alias_on_new_vm container_name