How to list VM images in LXD (Linux Containers)

last updated in Categories , , ,

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, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

2 comment

  1. I’m running lxc on a Centos7, and have for sometime now been trying to find a way to get ‘lxc’ – does anyone know where I can find the source.

    Have a question? Post it on our forum!