Someone mentions container technology.
You immediately associate to Docker.
Kubernetes.
Podman.
The IT world moved towards application containers.
They’re small. They’re replaceable.
Sometimes you need persistent machines with multiple services – you immediately go for virtualization.
The forgotten infrastructure of Linux Containers stays unmentioned.
LXC/LXD
Docker and Podman usually package applications, not machines.
A typical container contains the application and its dependencies, but not a complete operating system environment.
LXC is different.
LXC runs Linux environments inside containers.
But LXC is closer to virtualization.
An LXC container has:
- Init system (like systemd or OpenRC).
- Complete Linux user space (shell, libraries, utilities).
- Package manager (apt, apk, yum).
- Networking configuration.
- Users and permissions.
- Services managed independently.
LXC is built on native Linux kernel features.
It does not emulate hardware.
It uses namespaces and cgroups provided by the kernel to create isolated environments.
LXC treats a container less like a process and more like a lightweight server.
The difference is philosophical:
- Docker asks “How do I package this application?”
- LXC asks “How do I create an isolated Linux machine?”
Installation
Install LXC/LXD packages in your distribution.
On Debian:
apt install lxd lxd-client
Alternative tools exist, including Incus, the community continuation of LXD.
Configuration
Initialize the main configuration:
lxd init
Walk through the configuration and answer the questions.
Launch A Container
Launch a Debian Linux container:
lxc launch images:debian/13 irc
Container Lifecycle
Start:
lxc start irc
Stop:
lxc stop irc
Restart:
lxc restart irc
Delete:
lxc delete irc
Snapshots
Snapshots are not copies. They depend on the storage backend.
With copy-on-write filesystems like ZFS or Btrfs they can be almost instantaneous.
Manage snapshots:
lxc snapshot irc clean-statelxc delete irc/clean-state
Backup
A snapshot is not a backup.
A snapshot usually lives on the same storage system as the original container.
Export the container:
lxc export irc irc-backup.tar.gz
Import it:
lxc import irc-backup.tar.gz
Final Thoughts
You don’t have to settle with one solution.
A layered architecture can perform better.
LXC has its place in it.
Run Podman next to LXC.
Run LXC containers inside KVM virtual machines.
Run Podman containers inside LXC when the workload requires it.
The question is not “Which container technology wins?”
The question is “Which isolation layer fits the workload?”
Physical Server
|
+-- KVM Virtual Machine
| |
| +-- LXC Container
| | |
| | +-- nginx
| | +-- PostgreSQL
| | +-- Application
| |
| +-- Podman
| |
| +-- Stateless workloads
|
+-- LXC Container
|
+-- Infrastructure services
Discover more from Tom's IT Cafe
Subscribe to get the latest posts sent to your email.