vagrant/plugins/provisioners/docker/cap/centos/docker_install.rb
oss-core-libraries-dashboard[bot] ea57f40b89
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
[COMPLIANCE] Update Copyright and License Headers (#13752)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2025-12-04 17:07:40 +05:30

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