How to copy and import images

To add images to an image store, you can either copy them from another server or import them from files (either local files or files on a web server).

Note

The UI does not currently support copying or importing images.

There is support for importing custom ISO files, but these ISO files are different from images. When you create an instance from a custom ISO file, the ISO file is mounted as a storage volume in a new empty VM, and you can then install the VM from the ISO file. See Content type iso and Create a VM that boots from an ISO for more information.

Copy an image from a remote

To copy an image from one server to another, enter the following command:

lxc image copy [<source_remote>:]<image> <target_remote>:

Note

To copy the image to your local image store, specify local: as the target remote.

See lxc image copy --help for a list of all available flags. The most relevant ones are:

--alias

Assign an alias to the copy of the image.

--copy-aliases

Copy the aliases that the source image has.

--auto-update

Keep the copy up-to-date with the original image.

--vm

When copying from an alias, copy the image that can be used to create virtual machines.

Import an image from files

If you have image files that use the required Image format, you can import them into your image store.

There are several ways of obtaining such image files:

Import from the local file system

To import an image from the local file system, use the lxc image import command. This command supports both unified images (compressed file or directory) and split images (two files).

To import a unified image from one file or directory, enter the following command:

lxc image import <image_file_or_directory_path> [<target_remote>:]

To import a split image, enter the following command:

lxc image import <metadata_tarball_path> <rootfs_tarball_path> [<target_remote>:]

In both cases, you can assign an alias with the --alias flag. See lxc image import --help for all available flags.