LXD is an extremely powerful tool for managing Linux containers which are like super light virtual machines.

Running Ubuntu Core on LXD is also quite simple.

Step 0: Requirements & Getting LXD


To run Ubuntu Core on LXD there is one basic requirement: a linux machine running on x86_64 (or i686). This means you cannot run LXD on a Windows machine (not directly). And while you CAN run LXD on your Raspberry Pi (which is arm based), there are no Ubuntu Core images available for LXD on arm. (We may explore building an image for arm in another post :)

Installing LXD

Unlike Multipass, you can only install LXD on a linux machine. Currently the recommended way of installing LXD is with the snap; however if you’re running Alpine, Arch, or Fedora, it’s also available in the respective archives.

To install LXD as a snap run the following command sudo snap install lxd. Then run the initial setup, sudo lxd init. This command will run you through the basic setup for lxd, and you can accept all the defaults.

Hint: If you’re running Ubuntu it may already be installed. And if it is installed as a deb, I would suggest removing it first: sudo apt remove lxd.

Step 1: Starting you Ubuntu Core Container

Start your Ubuntu Core container with the following command: lxc launch images:ubuntu-core/16 my-ubuntu-core

Once your container has started you can see it in the list of running containers: lxc list. And finally you can connect to your container with ‘exec’: lxc exec my-ubuntu-core bash

Note: Your container maybe reboot multiple times after first boot. You can see below my container rebooted twice before it was usable. Then it rebooted a third time after I ran ‘snap refresh’ to update the system.