LXC and Docker: Roles and Tradeoffs
LXC
LXC is a userland toolset that combines Linux namespaces, cgroups, filesystem setup, capabilities and security policies. It makes it easier to configure a container without manually assembling every kernel feature.
Its mental model is a lightweight machine: a Linux environment with its own processes, network and filesystem view. LXC does not by itself solve every datacenter problem. Migration, portability and large-scale management need additional tools and careful configuration.
Docker
Docker uses the same general Linux primitives but focuses on a portable application package. The package contains the application and its libraries/dependencies. Images can be versioned, shared through registries and started using the same commands on different compatible hosts.
| Question | LXC | Docker |
|---|---|---|
| Main unit | Lightweight machine | Application |
| Main goal | System-level isolation | Repeatable application deployment |
| Portability | Container usually needs target setup | Image can be distributed and recreated |
| Ecosystem | Lower-level and more manual | Images, registries, builds and orchestration |
Tradeoff
Docker improves packaging and deployment consistency, but it does not remove security updates, storage costs, networking complexity or operational work. More portable application units can also create more services to monitor and update.
Lower-priority related systems
Flatpak and Snap also package Linux applications with dependencies and isolation, but the source distinguishes them from LXC and Docker. The pets/cattle analogy describes the historical move from unique servers to replaceable VMs, containers and short-lived functions.
Retrieval
If an exam asks whether LXC and Docker are identical, what is the best answer? They use related Linux isolation mechanisms, but LXC is more machine-oriented while Docker is more application-packaging-oriented.
Source: Lecture 07 - Lightweight Virtualization - LXC and Docker, PDF pages 18-35.