guests/redhat: install Docker on EL7 properly [GH-4402]
This commit is contained in:
parent
9ff18fb1b7
commit
6074a63683
|
@ -69,6 +69,7 @@ BUG FIXES:
|
|||
- guests/linux: Show more verbose error when shared folder mount fails.
|
||||
[GH-4403]
|
||||
- guests/redhat: NFS setup should use systemd for RH7+ [GH-4228]
|
||||
- guests/redhat: Detect RHEL 7 (and CentOS) and install Docker properly. [GH-4402]
|
||||
- guests/smartos: Use `pfexec` for rsync. [GH-4274]
|
||||
- guests/windows: Reboot after hostname change. [GH-3987]
|
||||
- hosts/arch: NFS works with latest versions. [GH-4224]
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
module VagrantPlugins
|
||||
module GuestRedHat
|
||||
module Cap
|
||||
class Flavor
|
||||
def self.flavor(machine)
|
||||
# Read the version file
|
||||
output = ""
|
||||
machine.communicate.sudo("cat /etc/redhat-release") do |type, data|
|
||||
output += data if type == :stdout
|
||||
end
|
||||
output.chomp!
|
||||
|
||||
# Detect various flavors we care about
|
||||
if output =~ /(CentOS|Red Hat Enterprise) Linux release 7/i
|
||||
return :rhel_7
|
||||
else
|
||||
return :rhel
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -21,6 +21,11 @@ module VagrantPlugins
|
|||
Cap::ConfigureNetworks
|
||||
end
|
||||
|
||||
guest_capability("redhat", "flavor") do
|
||||
require_relative "cap/flavor"
|
||||
Cap::Flavor
|
||||
end
|
||||
|
||||
guest_capability("redhat", "network_scripts_dir") do
|
||||
require_relative "cap/network_scripts_dir"
|
||||
Cap::NetworkScriptsDir
|
||||
|
|
|
@ -8,6 +8,23 @@ module VagrantPlugins
|
|||
machine.ui.warn(I18n.t("vagrant.docker_install_with_version_not_supported"))
|
||||
end
|
||||
|
||||
case machine.guest.capability("flavor")
|
||||
when :rhel_7
|
||||
docker_install_rhel7(machine)
|
||||
else
|
||||
docker_install_default(machine)
|
||||
end
|
||||
end
|
||||
|
||||
def docker_install_rhel7(machine)
|
||||
machine.communicate.tap do |comm|
|
||||
comm.sudo("yum -y install docker")
|
||||
comm.sudo("systemctl start docker.service")
|
||||
comm.sudo("systemctl enable docker.service")
|
||||
end
|
||||
end
|
||||
|
||||
def docker_install_default(machine)
|
||||
machine.communicate.tap do |comm|
|
||||
if ! comm.test("rpm -qa | grep epel-release")
|
||||
comm.sudo("rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm")
|
||||
|
|
Loading…
Reference in New Issue