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
|
2015-11-05 21:56:13 +00:00
|
|
|
# Attempt to install linux-image-extra for this kernel, if it exists
|
|
|
|
package_name = "linux-image-extra-`uname -r`"
|
|
|
|
comm.sudo("lsmod | grep aufs || modprobe aufs || apt-cache show #{package_name} && apt-get install -y #{package_name} || true")
|
2013-11-26 21:48:51 +00:00
|
|
|
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'")
|
2015-07-08 18:13:25 +00:00
|
|
|
|
|
|
|
# chmod the directory if it exists
|
|
|
|
comm.sudo("chmod 0755 /var/lib/docker")
|
2013-11-26 21:48:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|