Introduction
LXD is a system container and virtual machine manager that provides a unified experience for running full Linux operating systems. Unlike application containers such as Docker, LXD containers behave like lightweight virtual machines with their own init system, networking stack, and storage, while sharing the host kernel for near-native performance.
What LXD Does
- Runs full Linux distributions as system containers with their own init, users, and services
- Manages both containers (shared kernel) and virtual machines (full isolation) through the same CLI
- Provides a REST API for programmatic management and integration with orchestration tools
- Supports live migration of containers between hosts for maintenance and load balancing
- Offers built-in clustering for high availability across multiple physical servers
Architecture Overview
LXD is a daemon that manages LXC containers and QEMU virtual machines. It exposes a REST API consumed by the lxc command-line client and third-party tools. Storage is managed through pluggable backends including ZFS, Btrfs, LVM, and directory-based storage. Networking supports bridged, macvlan, and OVN-based configurations. The clustering subsystem uses a distributed database (Dqlite) to synchronize state across nodes.
Self-Hosting & Configuration
- Install via Snap on Ubuntu or from packages on other distributions
- Run
lxd initto configure storage pools, networking, and clustering interactively - Use profiles to define default resource limits, network interfaces, and storage for new instances
- Configure remote access by adding TLS certificates for the REST API
- Set up clustering by joining additional nodes to the leader with
lxd init --preseed
Key Features
- Near-native performance for system containers by sharing the host kernel
- Unified management of containers and VMs through a single toolchain
- Snapshot and restore capabilities for point-in-time recovery
- Resource limits for CPU, memory, disk I/O, and network bandwidth per instance
- Image-based workflows with a public image server hosting dozens of Linux distributions
Comparison with Similar Tools
- Docker — focuses on application containers; LXD runs full operating system environments
- Incus — a community fork of LXD maintained under the Linux Containers project
- Proxmox VE — provides a full hypervisor with a web UI; LXD is lighter and CLI-first
- libvirt/KVM — lower-level VM management; LXD provides a higher-level abstraction
- Podman — rootless application containers; LXD manages system-level containers and VMs
FAQ
Q: What is the difference between LXD containers and Docker containers? A: LXD containers run a full Linux init system and behave like lightweight VMs. Docker containers typically run a single application process. Both use Linux namespaces and cgroups.
Q: Can LXD run on non-Ubuntu distributions? A: Yes, LXD is available on many Linux distributions. The Snap package works across distros, and native packages exist for several distributions.
Q: How does LXD clustering work? A: LXD clustering synchronizes configuration across nodes using Dqlite. Instances can be placed on specific nodes, and containers can be live-migrated between cluster members.
Q: Is LXD suitable for production workloads? A: Yes, LXD is used in production for development environments, CI systems, and running multi-tenant services. Canonical offers commercial support through Ubuntu Pro.