2013-11-26 21:48:51 +00:00
|
|
|
module VagrantPlugins
|
2014-03-26 23:32:31 +00:00
|
|
|
module DockerProvisioner
|
2013-11-26 21:48:51 +00:00
|
|
|
module Cap
|
|
|
|
module Debian
|
|
|
|
module DockerInstall
|
|
|
|
def self.docker_install(machine, version)
|
|
|
|
package = 'lxc-docker'
|
|
|
|
package << "-#{version}" if version != :latest
|
|
|
|
|
|
|
|
machine.communicate.tap do |comm|
|
2015-06-24 12:56:28 +00:00
|
|
|
comm.sudo("apt-get update -y")
|
2013-11-26 21:48:51 +00:00
|
|
|
# TODO: Perform check on the host machine if aufs is installed and using LXC
|
|
|
|
if machine.provider_name != :lxc
|
|
|
|
comm.sudo("lsmod | grep aufs || modprobe aufs || apt-get install -y linux-image-extra-`uname -r`")
|
|
|
|
end
|
|
|
|
comm.sudo("apt-get install -y --force-yes -q curl")
|
2015-01-19 21:58:45 +00:00
|
|
|
comm.sudo("curl -sSL https://get.docker.com/gpg | apt-key add -")
|
2015-05-22 21:18:11 +00:00
|
|
|
comm.sudo("echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list")
|
2013-11-26 21:48:51 +00:00
|
|
|
comm.sudo("apt-get update")
|
2013-12-22 17:48:14 +00:00
|
|
|
comm.sudo("echo lxc lxc/directory string /var/lib/lxc | debconf-set-selections")
|
2013-11-26 21:48:51 +00:00
|
|
|
comm.sudo("apt-get install -y --force-yes -q xz-utils #{package} -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold'")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|