Mastering Windows Server 2016 Hyper-V

(Romina) #1

Invoke-WebRequest
https://master.dockerproject.org/windows/amd64/docker.exe -OutFile
$env:ProgramFiles\docker\docker.exe
Invoke-WebRequest https://master.dockerproject.org/windows/amd64/docker-
proxy.exe -OutFile $env:ProgramFiles\docker\docker-proxy.exe


If you ever need to update Docker to a new version, you will need to remove the old
one first. This can be accomplished with the following:


Stop-Service Docker
Remove-Item "C:\Program Files\Docker\docker.exe"
Remove-Item "C:\Program Files\Docker\dockerd.exe"


The next step is to pull down the base OS images, both Server Core and Nano Server.
In this example, docker.exe is used, which was added to the system path. You will
need to exit and restart your PowerShell window so that the Docker folder is now part
of the path and docker.exe found. (docker.exe will work in a PowerShell window
because it’s an executable, but you could also use cmd.exe.)


docker pull microsoft/windowsservercore
docker pull microsoft/nanoserver


This can also be done with PowerShell, which requires the ContainerImage OneGet
PowerShell module to be installed from GitHub:


Install-PackageProvider ContainerImage -Force
Find-ContainerImage
Install-ContainerImage -Name NanoServer
Install-ContainerImage -Name WindowsServerCore


You will notice in the PowerShell example that Find-ContainerImage was used to find
the base OS images that could be used with a Windows container host. To search for
base images using docker.exe, you can use docker search—for example:


docker search windowsserver


To find only official builds, you can add the is-official filter, for example. (I use
CentOS in the example, as at the time of writing there were no official builds for
Windows images.)


docker search centos --filter is-official=true


You can also search for all the published images via the Docker Hub website at
https://hub .docker.com/search/ after you have created a free account.


Once the base OS images are installed, they can be viewed using docker images or
Get-ContainerImage (after the full PowerShell module has been installed, which is
covered later in the chapter). The following is an example view of images after both
Windows Server images have been pulled from the Docker Hub.


PS C:> docker images
REPOSITORY TAG IMAGE ID

Free download pdf