2013-12-12 17:16:59 +00:00
|
|
|
module VagrantPlugins
|
2014-03-26 23:32:31 +00:00
|
|
|
module DockerProvisioner
|
2013-12-12 17:16:59 +00:00
|
|
|
module Cap
|
|
|
|
module Redhat
|
|
|
|
module DockerInstall
|
|
|
|
def self.docker_install(machine, version)
|
2013-12-14 00:56:13 +00:00
|
|
|
if version != :latest
|
|
|
|
machine.ui.warn(I18n.t("vagrant.docker_install_with_version_not_supported"))
|
|
|
|
end
|
|
|
|
|
2015-08-07 17:44:08 +00:00
|
|
|
machine.communicate.tap do |comm|
|
|
|
|
comm.sudo("yum -y update")
|
|
|
|
comm.sudo("yum -y remove docker-io*")
|
|
|
|
comm.sudo("curl -sSL https://get.docker.com/ | sh")
|
|
|
|
end
|
|
|
|
|
2014-08-31 05:44:48 +00:00
|
|
|
case machine.guest.capability("flavor")
|
2015-08-07 17:44:08 +00:00
|
|
|
|
2014-08-31 05:44:48 +00:00
|
|
|
when :rhel_7
|
2015-08-07 17:44:08 +00:00
|
|
|
docker_enable_rhel7(machine)
|
2014-08-31 05:44:48 +00:00
|
|
|
else
|
2015-08-07 17:44:08 +00:00
|
|
|
docker_enable_default(machine)
|
2014-08-31 05:44:48 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-07 17:44:08 +00:00
|
|
|
def self.docker_enable_rhel7(machine)
|
2014-08-31 05:44:48 +00:00
|
|
|
machine.communicate.tap do |comm|
|
|
|
|
comm.sudo("systemctl start docker.service")
|
|
|
|
comm.sudo("systemctl enable docker.service")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-07 17:44:08 +00:00
|
|
|
def self.docker_enable_default(machine)
|
2013-12-12 17:16:59 +00:00
|
|
|
machine.communicate.tap do |comm|
|
2015-08-07 17:44:08 +00:00
|
|
|
comm.sudo("service docker start")
|
|
|
|
comm.sudo("chkconfig docker on")
|
2013-12-12 17:16:59 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|