How to list VM images in LXD (Linux Containers)

Posted on in Categories , , , last updated May 29, 2017

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?

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. The syntax is as follows:

lxc image list images:
Sample outputs:

Fig.01: Listing all VM images
Fig.01: Listing all VM images

You can use the grep command or more command as follows:
lxc image list images: | more
lxc image list images: | grep -i 'debian'

Sample outputs:
Fig.02: Using the grep command to filter out images
Fig.02: Using the grep command to filter out images

You can apply filter as follows to just show alpine Linux vm images:
lxc image list images: 'alpine'
Fig.03: Using filters
Fig.03: Using filters

You can now create a VM as follows:
lxc launch images:alpine/3.5/amd64 alpine-www
lxc launch images:centos/7/amd64 cenots-db
lxc list

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 2 comments/add one below):

2 comment

Leave a Comment