Skip to content

Vagrant and LXD

2017-10-10

by Evan Hanson

Managing Development Environments

Vagrant logo

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

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, 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 and even OpenStack.

From LXC to LXD

To integrate these two tools we’ve been using the vagrant-lxc 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. 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)!

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, and if you’re running Ubuntu you can also refer to our quick-start guide 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 – we hope you find it useful.

------

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

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