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

Key features of InnoDB - insert cache, write twice, adaptive hash index details

The key features of the InnoDB storage engine inc...

Vue uses canvas handwriting input to recognize Chinese

Effect picture: Preface: Recently, I was working ...

Detailed explanation of mysql permissions and indexes

mysql permissions and indexes The highest user of...

Thoughts on truncation of multi-line text with a "show more" button

I just happened to encounter this small requireme...

Example to explain the size of MySQL statistics table

Counting the size of each table in each database ...

Detailed discussion of the differences between loops in JavaScript

Table of contents Preface Enumerable properties I...

Detailed explanation of docker's high availability configuration

Docker Compose Docker Compose divides the managed...

How to submit a pure HTML page, pass parameters, and verify identity

Since the project requires a questionnaire, but th...

How to reset the initial value of the auto-increment column in the MySQL table

How to reset the initial value of the auto-increm...

Steps to change mysql character set to UTF8 under Linux system

Table of contents 1. Check the MySQL status in th...

Centos6.5 glibc upgrade process introduction

Table of contents Scenario Requirements glibc ver...

Native js implementation of slider interval component

This article example shares the specific code of ...

Tutorial on customizing rpm packages and building yum repositories for Centos

1 Keep the rpm package downloaded when yum instal...

Summary of how to modify the root password in MySQL 5.7 and MySQL 8.0

MySQL 5.7 version: Method 1: Use the SET PASSWORD...