2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-Docker.ps1
|
|
|
|
|
## Desc: Install Docker.
|
2022-06-16 11:32:30 +02:00
|
|
|
## Must be an independent step because it requires a restart before we
|
2019-12-13 09:48:00 -05:00
|
|
|
## can continue.
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2022-09-13 08:13:08 +03:00
|
|
|
Write-Host "Install Docker CE"
|
|
|
|
|
$instScriptUrl = "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1"
|
|
|
|
|
$instScriptPath = Start-DownloadWithRetry -Url $instScriptUrl -Name "install-docker-ce.ps1"
|
|
|
|
|
& $instScriptPath
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2022-05-10 10:23:19 +02:00
|
|
|
Write-Host "Install-Package Docker-Compose v1"
|
2020-04-17 10:53:30 +03:00
|
|
|
Choco-Install -PackageName docker-compose
|
2020-03-17 16:46:13 +03:00
|
|
|
|
2022-05-10 10:23:19 +02:00
|
|
|
Write-Host "Install-Package Docker-Compose v2"
|
|
|
|
|
$dockerComposev2Url = "https://github.com/docker/compose/releases/latest/download/docker-compose-windows-x86_64.exe"
|
2022-09-13 08:13:08 +03:00
|
|
|
$cliPluginsDir = "C:\ProgramData\docker\cli-plugins"
|
|
|
|
|
New-Item -Path $cliPluginsDir -ItemType Directory
|
|
|
|
|
Start-DownloadWithRetry -Url $dockerComposev2Url -Name docker-compose.exe -DownloadPath $cliPluginsDir
|
2022-05-10 10:23:19 +02:00
|
|
|
|
2021-11-19 12:44:22 +01:00
|
|
|
Write-Host "Install docker-wincred"
|
|
|
|
|
$dockerCredLatestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/docker/docker-credential-helpers/releases/latest"
|
|
|
|
|
$dockerCredDownloadUrl = $dockerCredLatestRelease.assets.browser_download_url -match "docker-credential-wincred-.+\.zip" | Select-Object -First 1
|
|
|
|
|
$dockerCredArchive = Start-DownloadWithRetry -Url $dockerCredDownloadUrl
|
2022-09-13 08:13:08 +03:00
|
|
|
Expand-Archive -Path $dockerCredArchive -DestinationPath "C:\Windows\System32"
|
2021-11-19 12:44:22 +01:00
|
|
|
|
|
|
|
|
Write-Host "Download docker images"
|
2021-08-01 15:10:59 +03:00
|
|
|
$dockerImages = (Get-ToolsetContent).docker.images
|
|
|
|
|
foreach ($dockerImage in $dockerImages) {
|
|
|
|
|
Write-Host "Pulling docker image $dockerImage ..."
|
|
|
|
|
docker pull $dockerImage
|
|
|
|
|
|
|
|
|
|
if (!$?) {
|
|
|
|
|
Write-Host "Docker pull failed with a non-zero exit code"
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Invoke-PesterTests -TestFile "Docker"
|