Date

Create your first Container on Windows Server 2016/2019

Summary:

In this article we will learn steps by step process to install Docker EE (Enterprise Edition) on Windows Server 2016/2019 server

Prerequisites:

Windows Server 2016, build 1607 and above, Windows Server 2019 virtual machine or physical server

Step by Step process

1. Install Container feature from Server Manage

Install Container Feature from Add and Remover (Server Manager)

2. Install Docker

[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"

Install-Module Dockermsftprovider -Force 

install-package docker -ProviderName DockerMsftProvider -Force 

Name                           Version          Source           Summary

—-                           ——-          ——           ——-

Docker                         19.03.5          DockerDefault    Contains Docker EE for use with Windows Server.

3. Run following command to check Docker version

docker --version 

Docker version 19.03.5, build 2ee0c57608

4. Start Docker Service

net start docker 

5. Pull Container Image ServerCore-IIS

docker pull mcr.microsoft.com/windows/servercore/iis 

docker images 

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

microsoft/iis       servercore    d4d34a16ef9d        15 months ago       1.29GB

6. Create Container with IIS image

docker run -it -d -p 8000:80 --name=<<Container_ Name>>microsoft/iis:<<Tag>> 

Example:

docker run -it -d -p 8000:80 --name=web1 microsoft/iis:servercore 

7. To check running Container

docker ps 

CONTAINER ID        IMAGE                      COMMAND                   CREATED            STATUS           PORTS                            NAMES

b878e0ca55a1        microsoft/iis:servercore    “C:\\ServiceMonitor.e…”   34 seconds ago      Up 12 seconds       80/tcp, 0.0.0.0:8000->8000/tcp   web1

Additional Steps:

  1. To inspect Container Configuration:

docker inspect web1 

2. To enter into the Container

docker exec -it <<Container_ Name>> cmd 

Example:

docker exec -it web1 cmd 

Run Exit command to get out off container

3. To stop and Start Container, use following commands:

Docker container start <Container_name> 

Example:

Docker container start web1 

Docker stop <Container_Name>

Example:

Docker stop web1 

Resource:

Windows container version compatibility

https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-20H2%2Cwindows-10-20H2

AZmachina

Knowledge Shared = Knowledge2

We have created AZmachina blog to share our knowledge on Docker & Container and Kubernetes on Windows Servers with curious and enthusiastic novice learner. We hope that this will help them to take a swim in this vast ocean of Window Containers and Kubernetes

Happy Learning !
Recent Posts
Categories
Archives
Sumeet Kumar

Sumeet Kumar

I am Windows Core Engineer with 7+ years of experience in Windows Hyper-v, Failover Cluster, Windows Storage, Volume Shadow Copy (VSS), Docker & Containers on Windows Servers, Backup & Recovery, VMware vSphere EXSi & vCenter Server

RELATED

Articles

Leave a Reply

Your email address will not be published. Required fields are marked *