Skip to main content

Quick Usage Guide

In order to use the LXD commands, you will need to be the root user or part of the lxd group. To add your user to the group run sudo usermod -aG lxd <username> and then re-log.

To setup your first instance we first have to pick an image we want to base our container on. List all of the available images:

lxc image list images:
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+
|                  ALIAS                   | FINGERPRINT  | PUBLIC |                 DESCRIPTION                  | ARCHITECTURE |      TYPE       |   SIZE    |          UPLOAD DATE          |
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| almalinux/8 (3 more)                     | 21e057cee3e2 | yes    | Almalinux 8 amd64 (20220202_23:08)           | x86_64       | CONTAINER       | 127.28MB  | Feb 2, 2022 at 12:00am (UTC)  |
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| almalinux/8 (3 more)                     | 769da984cba4 | yes    | Almalinux 8 amd64 (20220202_23:08)           | x86_64       | VIRTUAL-MACHINE | 612.13MB  | Feb 2, 2022 at 12:00am (UTC)  |
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| almalinux/8/arm64 (1 more)               | d45a6ae571cc | yes    | Almalinux 8 arm64 (20220202_23:09)           | aarch64      | CONTAINER       | 123.92MB  | Feb 2, 2022 at 12:00am (UTC)  |
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| almalinux/8/cloud (1 more)               | 570ca9ed0ae4 | yes    | Almalinux 8 amd64 (20220202_23:09)           | x86_64       | VIRTUAL-MACHINE | 630.75MB  | Feb 2, 2022 at 12:00am (UTC)  |
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| almalinux/8/cloud (1 more)               | b05a170a3c29 | yes    | Almalinux 8 amd64 (20220202_23:09)           | x86_64       | CONTAINER       | 146.68MB  | Feb 2, 2022 at 12:00am (UTC)  |
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| almalinux/8/cloud/arm64                  | d41c307670d5 | yes    | Almalinux 8 arm64 (20220202_23:08)           | aarch64      | CONTAINER       | 142.84MB  | Feb 2, 2022 at 12:00am (UTC)  |
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| alpine/3.12 (3 more)                     | c20400acec8b | yes    | Alpine 3.12 amd64 (20220202_20:12)           | x86_64       | CONTAINER       | 2.89MB    | Feb 2, 2022 at 12:00am (UTC)  |
+------------------------------------------+--------------+--------+----------------------------------------------+--------------+-----------------+-----------+-------------------------------+

It will display a long list like above. Once you have found an image you want to base your container on, run the following:

lxc launch images:debian/11 debiantest

This will create a container with the name of debiantest, you can also optionally not enter a name and LXD will randomly generate one for you.

To enter the container:

lxc exec debiantest bash

Your container has been successfully created. From there you can do pretty much anything you would do on a normal Linux installation.