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>
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
# Copyright IBM Corp. 2010, 2025
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
require_relative "../container/installer"
|
|
|
|
module VagrantPlugins
|
|
module DockerProvisioner
|
|
class Installer < VagrantPlugins::ContainerProvisioner::Installer
|
|
# This handles verifying the Docker installation, installing it if it was
|
|
# requested, and so on. This method will raise exceptions if things are
|
|
# wrong.
|
|
# @return [Boolean] - false if docker cannot be detected on machine, else
|
|
# true if docker installs correctly or is installed
|
|
def ensure_installed
|
|
if !@machine.guest.capability?(:docker_installed)
|
|
@machine.ui.warn(I18n.t("vagrant.docker_cant_detect"))
|
|
return false
|
|
end
|
|
|
|
if !@machine.guest.capability(:docker_installed)
|
|
@machine.ui.detail(I18n.t("vagrant.docker_installing"))
|
|
@machine.guest.capability(:docker_install)
|
|
end
|
|
|
|
if !@machine.guest.capability(:docker_installed)
|
|
raise DockerError, :install_failed
|
|
end
|
|
|
|
if @machine.guest.capability?(:docker_configure_vagrant_user)
|
|
@machine.guest.capability(:docker_configure_vagrant_user)
|
|
end
|
|
|
|
true
|
|
end
|
|
end
|
|
end
|
|
end
|