Last active
October 26, 2023 16:39
-
-
Save ebell451/63208b8bc86859b4fb463fcd432eb241 to your computer and use it in GitHub Desktop.
Install Docker Engine on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
================================================================================================================== | |
Script to Install Docker Engine on Windows | |
================================================================================================================== | |
Created: 05/19/2023 | |
Author: Ethan Bell | |
GitHub: ebell451 | |
================================================================================================================== | |
Purpose: This script will either install or update Docker Engine on a Windows machine. | |
The folder you specify to download the artifacts must already exist. | |
================================================================================================================== | |
Inspiration: https://docs.docker.com/engine/install/binaries/#install-server-and-client-binaries-on-windows | |
================================================================================================================== | |
#> | |
$DrvLetter = Read-Host -Prompt 'What drive letter, no colon, are you downloading to?' | |
$DirName = Read-Host -Prompt 'What directory are you wanting to save the file to?' | |
$Version = ((Invoke-WebRequest -Uri https://download.docker.com/win/static/stable/x86_64/).Links | Select-Object href | select-object -last 1 -expandproperty href) | |
Start-BitsTransfer -Source https://download.docker.com/win/static/stable/x86_64/$Version -Destination "${DrvLetter}:\${DirName}\${Version}" | |
$Service = Get-Service -Name Docker -ErrorAction SilentlyContinue | |
if ($null -ne $Service) { | |
Stop-Service Docker | |
} | |
Expand-Archive "${DrvLetter}:\${DirName}\${Version}" -DestinationPath $Env:ProgramFiles -Force | |
if ($null -eq $Service) { | |
&$Env:ProgramFiles\Docker\dockerd --register-service | |
} | |
Start-Service Docker | |
Get-Service Docker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are easier ways if you want to use package managers in Windows such as:
Chocolately
choco install docker
choco install docker-compose
Scoop
scoop install main/docker
scoop install docker-compose