What are LXC & LXD Containers?
If you are working with containers then LXC and LXD are two terms you should become familiar with. The two types of technology are similar in more ways that just the fact they sound the same. Let’s take a look at what the main differences between them are and why they have become so popular with developers and admins alike.
Let’s start with LXC (Linux Containers). LXC’s provide a solution for virtualising software at the operating system level within the Linux kernel - at a high level the kernel is basically what allows an operating system to function properly. It’s basic task is to communicate with the hardware and software and to manage the systems resources as best as possible). LXC’s allow you to run a single application inside a virtual environment, although if you chose to do so you could virtualise a complete operating system. LXC’s carry a lot of advantages including making it easy to control a virtual environment using userspace tools from the host operating system (userspace refers to all code that runs outside an operating system kernel), requiring less overhead than a traditional virtual machine monitor (hypervisor) and because you are able to distribute single applications in containers it makes them far more portable.
In reality LXC’s a very similar to Docker and CoreOS containers due to the fact that LXC used to be the underlying technology that powered them both. LXC has been at the heart of the rapid growth of containers over the past few years and a lot of the LXC principles still remain key to the development of containers today.
Now we’ve looked at LXC we can now have a look at LXD. In their simplest form LXD are an extension of LXC. Another way to define LXD is to think of it as a REST API that connect to libxlc which is the LXC software library. LXD creates a system deamn that applications can access locally using a unix socket or alternatively over the network using HTTPS.
There are some major advantages to LXD. These include the fact a single server can run multiple LXC’s using a single system daemon which allows for much simpler management and also reduces overheads as you are only running a single machine. The LXD daemon also allows for more secure containers by taking advantage of host level security features. You can easily share resources with different containers because the LXD daemon handles network and data storage and these can be controlled by the user using the command line interface. One big differentiating feature over LXC is live container management and the ability to snapshot a running container.
As a developer or data centre admin you are probably wondering whether to use LXC or LXD. Well that isn’t a straightforward answer. In reality it is not a choice between LXC and LXD because they are not really disparate things. LXD depends on LXC, they are both being developed by the same collaboration of programmers. In simple terms, if you’re using LXD you are and always will also be using LXC. It is theoretically possible to use LXC without LXD but you wouldn’t really want to as on its own LXC only delivers basic features. For a production environment you will almost certainly want to use LXD.