Skip to content

Instantly share code, notes, and snippets.

@MagicJohnJang
Last active December 26, 2018 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MagicJohnJang/46655c4b3228ca2f636e38fc7c84eb11 to your computer and use it in GitHub Desktop.
Save MagicJohnJang/46655c4b3228ca2f636e38fc7c84eb11 to your computer and use it in GitHub Desktop.
Install Docker on Windows Server 2016 Core
param (
[string]$RequiredVersion = $args[0],
[string]$RequiredZipName = $args[1],
[string]$Username = $args[2]
)
$downloadURL = "https://dockermsft.blob.core.windows.net/dockercontainer/$($RequiredZipName)"
$copyPath = "C:\Users\$($Username)\AppData\Local\Temp\1\DockerMsftProvider\"
# Install the Docker Module Provider
Install-Module -Name DockerMsftProvider -Repository PSGallery
# Make the folder in Temp
Try {
Install-Package -Name docker -ProviderName DockerMsftProvider
} catch {}
# Downloads the Version
Start-BitsTransfer -Source $downloadURL -Destination $pwd\docker.zip
# Copy the version to the instalation folder
Copy-Item .\docker.zip $copyPath
# Renaming to the desired version name
Set-Location $copyPath
Copy-Item .\docker.zip $RequiredZipName
# Installing the desired version
Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose -RequiredVersion $RequiredVersion
# Restart the VM
Restart-Computer -Force
# Tested on WindowsServerCore-hyper 14393.0.161119-1705.RS1
# Usage: .\install_docker_package_win_server.ps1 '18.09.0' 'docker-18-09-0.zip' 'Administrator'
@MagicJohnJang
Copy link
Author

MagicJohnJang commented Dec 21, 2018

Usage:

.\install_docker_package_win_server.ps1 '18.09.0' 'docker-18-09-0.zip' 'Administrator'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment