Vagrant and LXD

Managing Development Environments

Vagrant logo

We use a variety of technologies to help us manage development environments. One of these is Linux Containers(external link) and more specifically LXC(external link).

LXC offers a way to run many distinct, isolated Linux machines together on a single host without the overhead of other virtualisation technologies (such as VirtualBox or VMware) that require running an entirely separate operating system and, as such, put a heavy load on a typical workstation.

Another such tool is Vagrant(external link), which gives developers a common workflow for managing virtual machines regardless of the underlying virtualisation technology. We happen to use it with Linux Containers, but Vagrant supports many other back ends like Docker(external link) and even OpenStack(external link).

From LXC to LXD

To integrate these two tools we’ve been using the vagrant-lxc(external link) plugin, and it’s proven to be a good workhorse. Since the plugin was created, however, the Linux Containers project has advanced significantly, most notably with the introduction of LXD, a container management daemon. This daemon adds a heap of new features, including a high-level interface that can be controlled through a REST API(external link). It’s intended to make common tasks easier than the (more arcane) LXC layer, and it does a good job of that.

So, with the LXC plugin showing its age* and LXD offering a host of new possibilities, we decided to develop a plugin that adds LXD support to Vagrant, and we’re proud to release the result (under an open source license, of course)!

The LXD release

This initial release supports most of Vagrant’s basic functionality, as well as a handful of niceties like snapshot management and container sharing. You can find more details about the project on its homepage(external link), and if you’re running Ubuntu you can also refer to our quick-start guide(external link) to setting up LXD for use with Vagrant.

If you’re using Vagrant or Linux Containers (or simply keen to give them a try), check out the plugin(external link) – we hope you find it useful.

------

*The vagrant-lxc plugin hasn’t seen any updates in a while(external link) and there are some questions around its current maintainership(external link).

Images sourced from:
 https://commons.wikipedia.org/wiki/File:Vagrant.png(external link) (Creative Commons Attribution Share Alike 3.0)
 https://linuxcontainers.org/(external link) (Creative Commons Attribution Non-Commercial Share Alike 4.0).