Well, I am recently playing with Vagrant after playing with Docker, and was trying to use them together (since I am forced to use a Windows machine at work and thought Vagrant would be better than booting up 4 Virtualbox machines together in order to test some crazy application setup my devious mind concocted)…
I read (some of) the documentation and figured it would be better to use docker provisioning (as opposed to provider) to keep things as similar as they were before (after all I was running docker inside a VBoxed Ubuntu). So I tried the example given in the docs, and created the following Vagrantfile, exactly as stated:
Vagrant.configure("2") do |config| config.vm.provision "docker" do |d| d.run "rabbitmq" end end
and was greeted with the following error:
$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... There are errors in the configuration of this machine. Please fix the following errors and try again: vm: * A box must be specified.
Ok, nothing to write home about, I needed to specify a box. Since I had recently completed the getting started examples, I thought the sensible thing to do would be use the same machine used before, hence I change my Vagrantfile to:
Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise32" config.vm.provision "docker" do |d| d.run "rabbitmq" end end
Just to be greeted with the following error:
(...) ==> default: Running provisioner: docker... default: Installing Docker (latest) onto machine... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! apt-get install -y --force-yes -q xz-utils lxc-docker -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' Stdout from the command: Reading package lists... Building dependency tree... Reading state information... Stderr from the command: stdin: is not a tty E: Unable to locate package lxc-docker
Well, that’s not good. After some head scratching, I kinda remembered that Docker was not available on the official repos of older Ubuntu versions and tried to replace the box hashicorp/precise32 with the more recent ubuntu/trusty32, just to get the same error on the my screen.
After a lot of cursing and reading sites about Docker and Vagrantfile, I went to the Docker Installation page (https://docs.docker.com/installation/ubuntulinux/) and finally, at the Prerequisites section, one line caught my eye:
Docker requires a 64-bit installation regardless of your Ubuntu version.
So, not only I needed a 14.04 or newer Ubuntu version, but I also needed 64 bit! So I changed my Vagrantfile to:
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.provision "docker" do |d| d.run "rabbitmq" end end
And it all went smoothly.