Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

What a System Container Is

A system container looks like a small Linux server from the inside: it boots an init system, runs several services, has its own users, and you log in to it and update it with the usual package manager. It shares the host's kernel, so it starts in seconds and uses little memory. An application container, such as a Docker container, runs one process from an image instead; the difference is explained in LXC vs Docker.

LXD and Incus manage both system containers and virtual machines (with QEMU and KVM) through one command-line tool and one REST API.

LXD and Incus

  • LXD: developed by Canonical. Its command-line client is called lxc, which is easy to confuse with the older LXC tools such as lxc-create.
  • Incus: a fork of LXD started in 2023 by the Linux Containers project. Its client is called incus. Most commands are the same apart from the name.

Installing

On Ubuntu, LXD is distributed as a snap:

sudo snap install lxd
sudo usermod -aG lxd $USER
sudo lxd init

Incus is packaged by several distributions. On Debian 13 and on Ubuntu 24.04 and later it is in the distribution's repositories; on Ubuntu, add the qemu-system package as well if you want virtual machines:

sudo apt install incus
sudo usermod -aG incus-admin $USER
sudo incus admin init

Log out and back in after joining the group, so the commands work without sudo. Debian 12 and the RHEL family have no package of their own; the Incus documentation lists third-party repositories (Zabbly for Debian and Ubuntu, a community repository for Rocky Linux), so check it for your release. Members of these groups control the daemon, which amounts to root access on the host, so add only trusted accounts. The init step asks about storage (a directory, ZFS, Btrfs, or LVM) and creates a network bridge; --minimal accepts the defaults, which use the slower directory storage.

Everyday Commands

TaskIncusLXD
Start a containerincus launchlxc launch
Listincus listlxc list
Run a commandincus execlxc exec
Stopincus stoplxc stop
Deleteincus deletelxc delete
incus launch images:debian/13 web1
incus exec web1 -- bash
incus list
incus launch images:debian/13 vm1 --vm

With LXD, the same pattern reads lxc launch ubuntu:24.04 web1. Which image servers are configured differs between the two; incus remote list or lxc remote list shows them. --vm creates a virtual machine instead of a container.

Snapshots

incus snapshot create web1 before-upgrade
incus snapshot restore web1 before-upgrade

In LXD the commands are lxc snapshot web1 before-upgrade and lxc restore web1 before-upgrade. Snapshots live on the same storage pool, so they do not replace backups; incus export or lxc export writes an instance to a file you can copy elsewhere.

Profiles and Limits

Without limits, a container can use all of the host's CPU and memory. Set them per instance or in a profile that many instances share:

incus config set web1 limits.cpu=2 limits.memory=2GiB
incus profile list
incus profile show default

The default profile gives every new instance its root disk and network device.

Networking

Init creates a bridge (incusbr0 or lxdbr0) with a private subnet, DHCP, and NAT to the outside, so containers reach the internet at once but are not reachable from it. To publish a service, add a proxy device that forwards a host port, or attach the instance to a bridge on the host's public network if your provider routes extra addresses to the server. Private ranges are explained in private IP address ranges.

When to Use Them

System containers fit many small Linux servers on one host: test machines, separate services per customer, or build environments. For one application packed as an image, Docker fits better (see what Docker is). For other operating systems or a kernel of your own, use a virtual machine.

Was this answer helpful?
Loading...