I am using LXD (“Linux Container”) a container “hypervisor” on Ubuntu Linux serer. How do I list all available VM images for installation in the LXD image store? Is it possible to list lxd images using lxc command line?
lxd is a system-wide daemon and lxd is a command line client to talk with the lxd daemon. So, you need to use the lxc command to list images in the LXD store. This page shows how to list VM images in LXD using the lxc.
How to list VM images in LXD
The syntax is:
lxc image list images:
You can use the grep command or more command as follows:
lxc image list images: | more
lxc image list images: | grep -i 'debian'
lxc image list images: | grep -i 'opensuse'
You can apply filter as follows to just show alpine Linux vm images:
lxc image list images: 'alpine'
lxc image list images: 'opensuse'
You can now create a VM as follows:
lxc launch images:alpine/3.8/amd64 alpine-www
lxc launch images:centos/7/amd64 cenots-db
lxc launch images:opensuse/15.0/amd64 opensuse-15
Getting help on image option
Type the following command:
lxc image help
Description: Manage images In LXD containers are created from images. Those images were themselves either generated from an existing container or downloaded from an image server. When using remote images, LXD will automatically cache images for you and remove them upon expiration. The image unique identifier is the hash (sha-256) of its representation as a compressed tarball (or for split images, the concatenation of the metadata and rootfs tarballs). Images can be referenced by their full hash, shortest unique partial hash or alias name (if one is set). Usage: lxc image [command] Available Commands: alias Manage image aliases copy Copy images between servers delete Delete images edit Edit image properties export Export and download images import Import images into the image store info Show useful information about images list List images refresh Refresh images show Show image properties Global Flags: --debug Show all debug messages --force-local Force using the local unix socket -h, --help Print help --project string Override the source project -q, --quiet Don't show progress information -v, --verbose Show all information messages --version Print version number Use "lxc image [command] --help" for more information about a command.
See lxd documents here for more info.