Fábio Rehm bio photo

Fábio Rehm

Software Developer and Open Source Enthusiast

Github Twitter LinkedIn Feed

Improving vagrant-lxc boxes

So I’ve played with Docker once again and have been looking around its codebase to find out how things work over there. Even though I’ve never wrote a single line of Go, it gave me some interesting insights about LXC itself and about packing up containers which influenced heavily the “next generation“ vagrant-lxc base boxes and the upcoming work I have in mind for the provider.

Starting with V3 boxes, vagrant-lxc will introduce a better approach for building base boxes and will also simplify the process of “promoting” existing containers to base vagrant boxes. While it won’t introduce breaking changes, V3 boxes should be pushing more work into the base box preparation allowing us to eventually have “generic” creation scripts + lxc configs built into vagrant-lxc itself.

I haven’t tried yet but at least in theory you could set up the vagrant user on an existing container, compress its rootfs and combine it with the new lxc template script, config file and metadata.json files to build a box. Eventually there will only be the need to have just the rootfs tarball and the metadata.json files, but for now I’d rather to not go in that direction until I’m 100% sure that this approach will work fine.

Because there is less work involved on creating new containers than it used to be, as you can see from the Asciicast below I was able to cut down around 47% / ~9sec of the time taken to bring a vagrant-lxc container up from scratch.

As a side note, I got to know asciinema.org/ since the last video I recorded and I'm pretty impressed by how easy it is to record a terminal session with it. You might want to check it out ;)

I’ve already rebuilt all of the current 6 boxes we’ve got and I’m doing some testing around them to see if things are working fine before release.

Ubuntu 13.10 comes with 9 different lxc templates apart from Ubuntu itself and Debian. I really hope this encourages people to contribute new boxes back to the project. As with Vagrant itself I don’t have plans to “officially” support boxes other than Ubuntu ones on the short term. Feel free to ping me in case you have trouble building them.

UPDATE: If you want to know more about building your own box have a look at this other post


Comments

comments powered by   Disqus