To install docker on Windows Server 2016, you need to run few commands, and you will get things ready for your containerization world.

I will share with you the installation steps and some docker commands and then the errors  (another article) that I have faced during this process.

Windows Server 2016 shipped with Docker Enterprise Edition for Windows Server (Docker EE) that enables Windows Server to run Docker-based containers.

Although developers today use to run many commands to get installation files online and to configure their tools afterward, in Windows world you simply need to run two commands to install it, and you will get the job done:

1- Open your PowerShell prompt and run the following lines

Install-Module DockerMsftProvider -Force

Install-Package Docker -ProviderName DockerMsftProvider –Force

image

It will take few minutes to get your system ready, and in most cases, you will need to restart your machine to apply your configuration.

You may write the below command, and it will till you if you need to restart or not.

(Install-WindowsFeature Containers).RestartNeeded
image

Once you have restarted your windows server, you can start using your new Docker host
Simple actions to begin with like get docker image and run it.
To get an image, you can use pull command as below


docker pull microsoft/windowsservercore
image

You can also get docker run Windows nano image which is the lightest version of windows today.

docker pull microsoft/nanoserver
image

You can run the container by just docker run command; you shall add some parameters to modify how your container starts.
In the next commands, I ran PowerShell inside the container to get inside the container.

docker run –it hello-world powershell
image

In the following screenshot, you can see that I run hostname and I got machine id as hostname
also, I ran ipconfig and it show that interface name is vEthernet (Container NIC)


image
You can list container running on your host by docker ps command
image
You will notice that by default hostname is the same as your container’s ID.
This article is a quick intro to docker, the examples here are for windows platform, you shall use the same commands on Linux containers with little modification like you use bash or sh instead of PowerShell and cmd.
 


            
Previous Article
Next Article