The process of installing Docker on Windows Server 2016 and the problems encountered

The process of installing Docker on Windows Server 2016 and the problems encountered

Prerequisites

To run containers on Windows Server, you need a physical server or virtual machine running Windows Server (Semi-Annual Channel), Windows Server 2019, or Windows Server 2016.

It is recommended to update the server first

Windows Server 2016 already supports Docker technology, and the official information is also provided:

https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-windows-server

There will be no problem referring to this link in general, but there is still a big pitfall.
Run sconfig using PowerShell, then select 6 and enter A to download all updates:

insert image description here
insert image description here

Install Docker

To install Docker on Windows Server, you can use the OneGet provider PowerShell module published by Microsoft, called DockerMicrosoftProvider. This provider enables the container functionality in Windows and installs the Docker engine and client. Here’s how to do it:
Open an elevated PowerShell session and install the Docker-Microsoft PackageManagement provider from the PowerShell Gallery.

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

If prompted to install the NuGet provider, also type Y to install it.
Install the latest version of Docker using the PackageManagement PowerShell module.

Install-Package -Name docker -ProviderName DockerMsftProvider

When PowerShell asks whether to trust the package source "DockerDefault", type A to proceed with the installation.
After the installation is complete, restart your computer.

Restart-Computer -Force

If you wish to update Docker later, do the following:

  • Use Get-Package -Name Docker -ProviderName DockerMsftProvider
  • To view the installed version, use Find-Package -Name Docker -ProviderName
  • After DockerMsftProvider finds the current version is ready, use Install-Package -Name Docker
  • ProviderName DockerMsftProvider -Update -Force to upgrade, then execute Start-Service Docker

verify

Enter docker version:

PS C:\Users\Administrator> docker version
Client: Docker Engine - Enterprise
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 2ee0c57608
Built: 11/13/2019 08:00:16
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Enterprise
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.24)
Go version: go1.12.12
Git commit: 2ee0c57608
Built: 11/13/2019 07:58:51
OS/Arch: windows/amd64
Experimental: false

At this point, the Docker installation is complete. Next, you can download some Docker files to play with, for example, by executing:

docker run microsoft/dotnet-samples:dotnetapp-nanoserver

This example will automatically download the Docker file and run it, but the download speed is extremely slow. I hope your download is successful.
For the next introduction, you can refer to this article:
https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-images

Problems encountered

Unable to use install-module :

PS C:\Users\Administrator> Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable. Please try again later.
Location: C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1711 Characters: 9
+ Get-PSGalleryApiAvailability -Repository $Repository
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException
+ FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability

Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable. Please try again later.
Location: C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4437 Characters: 9
+ Get-PSGalleryApiAvailability -Repository $Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException
+ FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability

Solution:
Open PowerShell as an administrator and enter the following commands in sequence:

$ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
$ Install-Module posh-ssh

In addition, please ensure that your machine can access the Internet.

PS C:\Users\Administrator> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
PS C:\Users\Administrator> Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

Name Version Source Summary
---- ------- ------ -------
nuget 2.8.5.208 https://onege... NuGet provider for the OneGet meta-package manager

PS C:\Users\Administrator> Install-Module posh-ssh

References:

[1] https://cloud.tencent.com/developer/article/1378641

[2] https://docs.microsoft.com/zh-cn/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server

This is the end of this article about installing Docker on Windows Server 2016. For more information about installing Docker on Windows Server 2016, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker installation of RocketMQ and solutions to problems encountered during installation
  • Docker-compose installation yml file configuration method
  • Detailed steps for installing ros2 in docker
  • The most detailed method to install docker on CentOS 8
  • Detailed process of installing logstash in Docker
  • Quick installation of Docker step-by-step tutorial

<<:  Introduction to the graphic composition and typesetting capabilities of web design

>>:  Detailed explanation of data sharing between Vue components

Recommend

Mysql optimization tool (recommended)

Preface While browsing GitHub today, I found this...

Detailed explanation of Vue routing router

Table of contents Using routing plugins in a modu...

Summary of various forms of applying CSS styles in web pages

1. Inline style, placed in <body></body&g...

How to limit the number of records in a table in MySQL

Table of contents 1. Trigger Solution 2. Partitio...

JavaScript to add and delete messages on the message board

This article shares a small example of adding and...

Image hover toggle button implemented with CSS3

Result:Implementation Code html <ul class=&quo...

Navicat for MySQL scheduled database backup and data recovery details

Database modification or deletion operations may ...

CSS to achieve fast and cool shaking animation effect

1. Introduction to Animate.css Animate.css is a r...

Detailed explanation of the principle of creating tomcat in Eclipse

When creating a tomcat server on a local eclipse,...

Detailed explanation of Linux netstat command

Table of contents Linux netstat command 1. Detail...

HTML table layout example explanation

The elements in an HTML document are arranged one...

An article to teach you HTML

If you are not committed to becoming an artist, t...