Home

Awesome

Docker-friendly Vagrant base boxes

<img src="http://blog.phusion.nl/wp-content/uploads/2013/11/vagrant.png" height="150"> <img src="http://blog.phusion.nl/wp-content/uploads/2013/11/docker.png" height="150">

This repository contains definitions for various Docker-friendly Vagrant base boxes. There are boxes that are based on Ubuntu 12.04 64-bit, and boxes that are based on Ubuntu 14.04 64-bit. They differ from the ones provided by vagrantup.com in the following ways:

These base boxes are automatically built from Veewee definitions. These definitions make building boxes quick and unambigious. The entire building process is described in the definitions; no manual intervention is required.

We provide prebuilt boxes at https://oss-binaries.phusionpassenger.com/vagrant/boxes/, but you can build them yourself if you so wish.

The boxes are also available on Vagrant Cloud.

Related resources: Github | Prebuilt boxes | Vagrant Cloud | Discussion forum | Twitter | Blog

Using these boxes in Vagrant

If you have Vagrant 1.5, you can use our boxes through Vagrant Cloud:

vagrant init phusion/ubuntu-14.04-amd64
# -OR-
vagrant init phusion/ubuntu-12.04-amd64

On older Vagrant versions, you can modify your Vagrantfile to use our boxes. Here is an example Vagrantfile which works with both VirtualBox and VMWare Fusion. It also automatically installs the latest version of Docker.

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "phusion-open-ubuntu-14.04-amd64"
  config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box"
  # Or, for Ubuntu 12.04:
  #config.vm.box = "phusion-open-ubuntu-12.04-amd64"
  #config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-12.04-amd64-vbox.box"

  config.vm.provider :vmware_fusion do |f, override|
    override.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vmwarefusion.box"
    #override.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-12.04-amd64-vmwarefusion.box"
  end

  # Only run the provisioning on the first 'vagrant up'
  if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
    # Install Docker
    pkg_cmd = "wget -q -O - https://get.docker.io/gpg | apt-key add -;" \
      "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list;" \
      "apt-get update -qq; apt-get install -q -y --force-yes lxc-docker; "
    # Add vagrant user to the docker group
    pkg_cmd << "usermod -a -G docker vagrant; "
    config.vm.provision :shell, :inline => pkg_cmd
  end
end

You can login with username vagrant and password vagrant. This user has sudo privileges. The root user also has password vagrant.

The prebuilt boxes are available at https://oss-binaries.phusionpassenger.com/vagrant/boxes/

Next steps

<img src="http://www.phusion.nl/assets/logo.png">

These Vagrant boxes are provided to you by Phusion. You may want to check out these too:

Building the boxes yourself

Setup your environment

  1. Install Vagrant.

  2. Install VirtualBox or VMWare Fusion.

  3. Install 7-zip (OS X: brew install p7zip).

  4. bundle install --path vendor

    The --path is important! Not installing with --path will break Vagrant.

Building a box and importing it into Vagrant

VirtualBox:

bundle exec rake virtualbox:ubuntu-14.04-amd64:all
bundle exec rake virtualbox:ubuntu-12.04-amd64:all

VMWare Fusion:

bundle exec rake vmware_fusion:ubuntu-14.04-amd64:all
bundle exec rake vmware_fusion:ubuntu-12.04-amd64:all