From d87d421586bbf06268f2e1acc9d106046d398be6 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 27 Mar 2020 10:12:43 -0400 Subject: [PATCH] Install docker using docker repo instead of convenience script This approach will be more stable than depending on a convenience script provided by docker ref: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-convenience-script --- .../provisioners/docker/cap/redhat/docker_install.rb | 10 +++++++--- templates/locales/en.yml | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/provisioners/docker/cap/redhat/docker_install.rb b/plugins/provisioners/docker/cap/redhat/docker_install.rb index 76555749b80..027864304e3 100644 --- a/plugins/provisioners/docker/cap/redhat/docker_install.rb +++ b/plugins/provisioners/docker/cap/redhat/docker_install.rb @@ -4,15 +4,19 @@ module Cap module Redhat module DockerInstall def self.docker_install(machine) + machine.ui.warn(I18n.t("vagrant.provisioners.docker.rhel_not_supported")) + if machine.guest.capability("flavor") == :rhel_8 - machine.ui.warn("Docker is not supported on RHEL 8 machines.") raise DockerError, :install_failed end - + machine.communicate.tap do |comm| comm.sudo("yum -q -y update") comm.sudo("yum -q -y remove docker-io* || true") - comm.sudo("curl -fsSL https://get.docker.com/ | sh") + comm.sudo("yum install -y -q yum-utils") + comm.sudo("yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo") + comm.sudo("yum makecache") + comm.sudo("yum install -y -q docker-ce") end case machine.guest.capability("flavor") diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 743be476141..a9481fd1262 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -2821,6 +2821,9 @@ en: provisioner not_running: "Docker is not running on the guest VM." install_failed: "Docker installation failed." + rhel_not_supported: |- + RHEL is now only supported by Docker EE. Please install Docker EE or + switch to the Podman provisioner to run containers on RHEL. salt: minion_config_nonexist: |-