Exporting and importing VMs
Use anka export and anka import to archive a VM and move it to another host or user without a registry.
Export
- Only available for Enterprise or Enterprise Plus licenses.
- Exporting a VM is performing a unique copy like
anka clone -cwould do if it has no tags. - If you export a tagged VM in a chain (a VM that was cloned from another, or a tag on top of another VM tag), it will only export the VM layers that relate to that tag. You have to export and import all tags in the order they were created. This adds a fair bit of complexity though as each VM Tag is its own separate layer. When exporting, you’ll need to ensure the target is active on the host. To make it active, you can
anka pull --tag 1 templateA(--localmay speed this up if it was already pulled). Once active, exporting it requires--tag <val>.
This feature does not work if chunk_size is in use for the VM templates/tags.> anka export --help
usage: export [options] vmid [file]
Export a VM as an archive
arguments:
vmid VM to export
file Path to archive file
options:
-t,--tag <val> Export local VM tag
-n,--dry-run Just show files affected
Import
> anka import --help
usage: import [options] [file]
Import VM from an archive
arguments:
file Tarball with an exported VM/tag or filesystem layer
options:
--fetch-only Import VM tag without checkout
-v,--vmid <val> VM to import filesystem layer to
-n,--dry-run Just show files being imported
--transform <val> Use sed replace expression to transform file names
You can import a VM from a URL usingcurl -s VM.tar | anka importorssh [email protected] dd if="VM.tar" | anka import
Export and import an OCI tag
anka export and anka import move a tag between hosts when you do not use a registry. Export has no --thin flag. With push_mode 1, export of the first tag writes the VM as a full tag. That tag has no parent tag. Import of that archive creates a VM that boots and keeps the tag. With push_mode 2, export writes a thin tag: the diff for the tag you name. The vanilla diff is empty, so that export does not include the macOS disk. xcode-27.1 exports the Xcode files. cmake exports the CMake files. anka export -c does not add the base tag while push_mode is 2. Import with -v applies that diff onto a VM that already exists.
❯ anka export 27.0.1 xcode-27.1.tar -t xcode-27.1
❯ anka import xcode-27.1.tar -v 15.6.1
15.6.1 must already exist. Import applies that tag’s layer onto it. Import the tags in the order you created them.
Related
- Templates and Registries to store templates in the Anka Registry or in an OCI registry
- OCI tags
- Edit a layer before you push it with anka-oci-tag-editor