2

I'm using a linux desktop with an 3.2 kernel (Ubuntu 12.04) and would like to test out using vagrants docker provider/provisioning.

So I make a Vagrantfile in root:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "app" do |v|
    v.vm.provider "docker" do |d|
      d.cmd     = ["/sbin/my_init", "--enable-insecure-key"]
      d.image   = "phusion/baseimage"
      d.has_ssh = true
      d.vagrant_vagrantfile = "./docker/Vagrantfile"
    end

    v.ssh.username = "root"
    v.ssh.private_key_path = "phusion.key"
  end
end

The containers vagrantfile (./docker/Vagrantfile) looks like this:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"
  config.vm.provision "docker"
  config.vm.provision "shell", inline:
    "ps aux |grep 'sshd:' | awk '{print $2}' | xargs kill"
end

(actually these files are from the blog post)

Trouble is when I do a

 $ vagrant up --provider=docker

I get the following error:

Bringing machine 'app' up with 'docker' provider... The executable 'docker' Vagrant is trying to run was not found in the PATH variable. This is an error. Please verify this software is installed and on the path.

I rather expected that it would launch a virtualbox instance with ./docker/Vagrantfile, the precise64 image provisioned for docker, and that it wouldn't be necessary to have a locally installed docker (which is not possible because I'm on 3.2)?

If someone can reproduce this or spot an obvious error, I would appreciate a comment or answer. Thank you!

Edited: The example above is a bit more complicated than needed to check out the problem. I can't really use the docker provider at all so I suspect a vagrant bug unless there is something obviously wrong here.

A simpler way to reproduce using this Vagrantfile:

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "app" do |v|
    v.vm.provider "docker" do |d|
      d.cmd     = ["/sbin/my_init", "--enable-insecure-key"]
      d.image   = "phusion/baseimage"
      d.has_ssh = true
    end

    v.ssh.username = "root"
    v.ssh.private_key_path = "phusion.key"
  end
end

When I try to use it:

$ uname -a
Linux ubuntu1204 3.2.0-64-generic #97-Ubuntu SMP Wed Jun 4 22:04:21 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ vagrant up --provider=docker
Bringing machine 'app' up with 'docker' provider...
The executable 'docker' Vagrant is trying to run was not
found in the PATH variable. This is an error. Please verify
this software is installed and on the path.

1 Answer 1

3

As you are using Vagrant on Linux, the "proxy VM" is not used by default, as Vagrant assumes that docker is installed directly to your host machine.

You can anyway force it:

Vagrant.configure("2") do |config|
  config.vm.provider "docker" do |d|
    d.force_host_vm = true
    # ...
  end
end

The proxy VM, which you optionally specify with d.vagrant_vagrantfile, needs to have docker installed. Of course you can install it with a provisioner (in ./docker/Vagrantfile in your case). In most cases the default boot2docker box should be enough though.

The up-to-date docker provider documentation for the latest Vagrant version can be found here: https://docs.vagrantup.com/v2/docker/

2
  • Hi, thanks for answering, but it's not relevant for my question. My problem is that it doesn't try to spin up any machine at all. It just complains that I'm missing docker on local machine. I'm thinking it could be a bug in vagrant.
    – grm
    Commented Jun 13, 2014 at 13:37
  • Ah, gotcha. Your issue is that Vagrant won't use the proxy VM by default on Linux as you can just install and run docker directly in it. I edited the answer accordingly.
    – tmatilai
    Commented Jun 14, 2014 at 21:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .