Install docker on alpine

This commit is contained in:
Benoît de Biolley 2025-12-22 11:52:12 +01:00
parent 14603574e6
commit 240331556e
No known key found for this signature in database
GPG key ID: 0289E94552874227

View file

@ -81,14 +81,7 @@ class InstallDocker
} elseif ($supported_os_type->contains('arch')) {
$command = $command->merge([$this->getArchDockerInstallCommand()]);
} elseif ($supported_os_type->contains('alpine')) {
$command = $command->merge([
"echo 'Installing Prerequisites...'",
'apk update',
'command -v curl >/dev/null || apk add curl',
'command -v wget >/dev/null || apk add wget',
'command -v git >/dev/null || apk add git',
'command -v jq >/dev/null || apk add jq',
]);
$command = $command->merge([$this->getAlpineDockerInstallCommand()]);
} else {
$command = $command->merge([$this->getGenericDockerInstallCommand()]);
}
@ -168,6 +161,13 @@ class InstallDocker
'systemctl start docker.service';
}
private function getAlpineDockerInstallCommand(): string
{
return "echo 'Installing Prerequisites...' && ".
'apk update && '.
'apk add docker';
}
private function getGenericDockerInstallCommand(): string
{
return "curl --max-time 300 --retry 3 https://releases.rancher.com/install-docker/{$this->dockerVersion}.sh | sh || curl --max-time 300 --retry 3 https://get.docker.com | sh -s -- --version {$this->dockerVersion}";