LXC and LXD — Canonical‘s answer (sort of) to CoreOS and Docker — are finally out in stable form. Are they ready to make their mark on the open source container ecosystem? Here’s an overview of these newest container products.
If you’re confused by what LXC and LXD are, and how they relate to one another, you’re not alone. The details are a little complicated, so let’s explain.
Put simply, LXC is an open source virtualization platform for the Linux kernel, which makes it possible to run entire operating systems or (with some work) single apps in a virtual environment on top of Linux. LXC used to be the basis for Docker containers, too, but Docker moved to its own engine a while ago.
LXD, meanwhile, is essentially an extension of LXC. LXD provides some extra features that are not available in LXC itself, such as the ability to do live migrations of containers, and to take real-time snapshots of them. LXD also makes it a lot easier to manage LXC containers by providing an API for the LXC software library, libxlc. That means you can orchestrate LXC through a clean, unified programming interface.
The development of LXC and LXD alike has been supported heavily by Canonical, the company behind Ubuntu Linux. Canonical has been keen to emphasize that it does not see LXD as a competitor to Docker or CoreOS rkt but rather a container solution that caters to a different set of workloads — namely, running complete operating systems in containers, rather than single apps, as you would usually do with Docker or rkt. Still, to an extent, LXD functionality overlaps with that of the containers from Docker and CoreOS — so these products are all in competition with one another to a certain extent.
Until recently, LXD was of little real-world significance because it was still in heavy development. (And LXC, for its part, was not very useful for production because it is designed to be used in conjunction with LXD, not on its own.) But that changed when LXD 2.0, the first production release, debuted on April 11, 2016. (There was never an LXD 1.0; the developers jumped directly to LXD 2.0, since this release is tied to LXC 2.0.)
With the release, LXD’s core features are now complete, and the tool is ready for real-world deployments. This makes it a viable alternative to Docker and CoreOS for some contexts.
If you’d like to give LXC and LXD a whirl, the developers have a handy online demo service, where you can spin up containers through a Web interface and get to know the LXC and LXD CLI environment. As you’ll see, it’s easy to create containers based on complete OS images, especially Ubuntu.
Will LXC and LXD draw developers and admins away from Docker or CoreOS? For now, it looks like this won’t happen as much as LXC and LXD will provide ways to use containers to solve new sorts of challenges. If you want to run a complete OS in a container, LXC and LXD are your answer. If you want to run a single containerized app, go with Docker or CoreOS.
Of course, it might be hard to imagine why you would want to run a complete OS inside a container. You can already virtualize operating systems quite easily using a traditional hypervisor — like VMware, or KVM, or Hyper-V, or whatever floats your boat.
That said, LXC and LXD make it easier than ever to run a guest OS virtually. Plus, they integrate the guest into the host environment with fewer inelegant tricks and weird workarounds than you’d get from an old-school hypervisor, since guests and hosts can directly share networking and storage. These features are really what make LXC and LXD interesting, and worth trying out for yourself.