mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
Some checks failed
/ sync-acceptance (push) Has been cancelled
Vagrant Ruby Tests / Vagrant unit tests on Ruby 3.1 (push) Has been cancelled
Vagrant Ruby Tests / Vagrant unit tests on Ruby 3.2 (push) Has been cancelled
Vagrant Ruby Tests / Vagrant unit tests on Ruby 3.3 (push) Has been cancelled
Vagrant Ruby Tests / Vagrant unit tests on Ruby 3.4 (push) Has been cancelled
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
44 lines
1.4 KiB
Ruby
44 lines
1.4 KiB
Ruby
# Copyright IBM Corp. 2010, 2025
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
module VagrantPlugins
|
|
module DockerProvisioner
|
|
module Cap
|
|
module Centos
|
|
module DockerInstall
|
|
def self.docker_install(machine)
|
|
machine.communicate.tap do |comm|
|
|
comm.sudo("yum -q -y update")
|
|
comm.sudo("yum -q -y remove docker-io* || true")
|
|
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")
|
|
when :centos
|
|
docker_enable_service(machine)
|
|
else
|
|
docker_enable_systemctl(machine)
|
|
end
|
|
end
|
|
|
|
def self.docker_enable_systemctl(machine)
|
|
machine.communicate.tap do |comm|
|
|
comm.sudo("systemctl start docker.service")
|
|
comm.sudo("systemctl enable docker.service")
|
|
end
|
|
end
|
|
|
|
def self.docker_enable_service(machine)
|
|
machine.communicate.tap do |comm|
|
|
comm.sudo("service docker start")
|
|
comm.sudo("chkconfig docker on")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|