Docker Community Forums

Share and learn in the Docker community.

Installing Docker on Windows Server 2019

I am looking to install Docker on a GCP Windows Server 2019 VM instance, but see no official documentation on how to do so. Everything I see on the Docker site is either for Windows Desktop, Mac, or Linux.

Is there any official documentation on how to install Docker on Windows Server 2019?

I do see third party write-ups on this, but have encountered various difficulties trying to follow them.

Ultimately, I will wish to produce images of an application on this server and deploy them to the Google Kubernetes Engine, in case this information is relevant.

Thanks for any assistance.

Step 1: Enable the containers feature in Windows Server 2019
The first step is to enable the Windows Server 2019 containers feature. Open PowerShell as Administrator.

Run the following commands.

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
This will install the Docker-Microsoft PackageManagement Provider from the PowerShell Gallery.

Sample output is as shown below:

Step 2: Install Docker on Windows Server 2019
once the Containers feature is enabled on Windows Server 2019, install the latest Docker Engine and Client by running the command below in your PowerShell session.

Install-Package -Name docker -ProviderName DockerMsftProvider
Agree to the installation using “Yes” or “Y” or “A” to Agree to all.

When the installation is complete, reboot the computer.

Restart-Computer -Force
Installed Docker version can be checked with:

Administrator> Get-Package -Name Docker -ProviderName DockerMsftProvider
Name Version Source ProviderName

docker 18.09.2 DockerDefault DockerMsftProvider
The same can be achieved with the docker --version command.

PS C:\Users\Administrator> docker version
Version: 18.09.2
API version: 1.39
Go version: go1.10.6
Git commit: 1ac774dfdd
Built: unknown-buildtime
OS/Arch: windows/amd64
Experimental: false
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
Upgrade can be done anytime by running the following commands on PowerShell.

Install-Package -Name Docker -ProviderName DockerMsftProvider -Update -Force
Start-Service Docker
Step 3: Run Docker Container
Start Docker Daemon

Start-Service Docker
After starting Docker Engine service, Download the pre-created .NET sample image from the Docker Hub registry:

docker pull microsoft/dotnet-samples:dotnetapp-nanoserver-1809
Then deploy a simple container running a .Net Hello World application.

docker run microsoft/dotnet-samples:dotnetapp-nanoserver-1809
The container will start, print the hello world message, and then exits.

Thank you so much for this information! I will run through the instructions today.