Tuesday, April 22, 2014

Issues using Docker provisioning on Vagrant

Problem

I wanted to try my hands with Docker provisioning on Vagrant this weekend and came across tons of issues and the main issue was around docker provisioner...

* The 'docker' provisioner could not be found.  (was using super old Vagrant version 1.3.5 so upgraded to 1.5.3)

Vagrantfile Sample 1

Vagrant.configure("2") do |config|
  config.vm.box = "oel631"
  config.vm.provision "docker",
    images: ["ubuntu"]
end



Error while trying to bring up my VM / provision it when it was already running

Docker is not running on the guest VM.


Vagrantfile Sample 2 

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"

  config.vm.provision "docker" do |d|
    d.pull_images "ubuntu"
  end
end


Vagrant assumes that this means the command failed!
service docker start
Stdout from the command:
Stderr from the command:
stdin: is not a tty
start: Job is already running: docker


Vagrantfile Sample 3

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"

  config.vm.provision "docker" do |d|
    d.run "ubuntu",
      cmd: "bash -l",
      args: "-v '/vagrant:/var/www'"
    end
end


The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

service docker start

Stdout from the command:



Stderr from the command:

stdin: is not a tty
start: Job is already running: docker


Solution

Got a resolution to upgrade to Vagrant 1.5.4 from the issue below after spending so much time on Google reading 1000's of post where people have used Docker provisioning on Vagrant. Seems to me like Vagrant 1.5.3 was the killer. I personally think Vagrant 1.5.3 doesnt really work well with Docker provisioning.

https://github.com/mitchellh/vagrant/issues/3487

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Coul you please provide contact number & mail ID. I am looking for training into this

    ReplyDelete