03 Oct 2014

i386 Docker Virtual Machine-like Containers in Vagrant

There are plenty of reasons why what I’m trying to do might be a bad idea, and I won’t bother to go into them, but suffice to say that I know that Docker isn’t really about virtual machines that persist, and I know that it doesn’t really like running on 32-bit machines. That said, I had a linux VM and a Vagrantfile that could spin up a build environment for a project, and I wanted to try out Docker as a Vagrant provider, so I did. It was messy, but it worked, sort of, so here are my notes, in case they help someone else. There were a lot of bits of this investigation and I’ve done my best to lay them out in the right order.

The Phusion Baseimage for Docker is what you need to get a VM that hangs around without a process active.

Vagrant wrote a bit about using the baseimage in their blog, here. Without those clues, I’d never have got it running in Vagrant.

The SSH key they reference that is built into the Baseimage can be found here.

Some kind soul has made a version of the Phusion Baseimage for i386, which you can find at yebyen/baseimage:i386.

So your Vagrantfile ends up looking like this:

Vagrant.configure("2") do |config|
  config.vm.provider "docker" do |d|
    d.cmd     = ["/sbin/my_init", "--enable-insecure-key"]
    d.image   = "yebyen/baseimage:i386"
    d.has_ssh = true

  config.ssh.username = "root"
  config.ssh.private_key_path = "phusion.key"