+5 votes
245 views
How to install containers on Windows Server 2016

in Windows Server by (551k points)
reopened | 245 views

1 Answer

+3 votes
Best answer

1. Types of containers for Windows Server 2016
2. Install Docker on Windows Server 2016
3. Update the Windows Server 2016 Operating System
4. Deployment of containers in Windows Server 2016

The scalability of an operating system is essential when we talk about corporate teams since thanks to this it is possible to add many more functionalities to the system such as applications, roles and programs always looking to add more use options to end users..

Windows Server 2016 is an integral operating system in which we find a wide variety of roles developed for a centralized administration of users, groups and elements always with secure and reliable bases.

One way we can get the most out of Windows Server 2016 is by installing containers , also known as Docker, which provide us with the necessary tools both to create and manage all the containers available for Windows Server 2016 and the resources associated with it..

A container has been developed focused with the purpose of being able to wrap an application in its own box in isolation. For the application that exists in the container, it is not aware of any other application or process that exists outside its box or box, from this point of view all the elements that the application needs to function correctly are available within this container, So, no matter where the box moves, the application will always be available and ready to be used because it is packed with everything you need to run on the operating system where you reside.

The containers have been designed as a portable, isolated, controlled runtime environment that can be run on a host machine or virtual machine with full functionality. An application or process that is executed in a container will be packaged with all the necessary dependencies and configuration files so that its use is efficient and has no problem for the user or administrator ..

The container host offers a set of resources for the container and the container will only use these resources without accessing other resources of the physical equipment thus ensuring that the final performance will not be affected.

There are a number of concepts at the container level that are useful to know when working with them, these are:

Container Host
This term refers to the physical or virtual operating system configured with the Windows Container function. The container host can run one or more Windows Containers itself.
Container Image
When modifications are made to the container or log file system, these are captured in a limited environment, this is the task of this container, once the container has stopped, that sandbox can be discarded or converted into a New container image.
Sandbox
When we have started a container, all write actions such as file system modifications, registry modifications or software installations are captured in this layer of 'sandbox' in Windows Server 2016.
Image of container OS (Container OS Image)
Each container is displayed from an image. The image of the OS of the container is the first layer that composes a container. This image provides the operating system environment. An image of the OS of the container is immutable, that is, that this image cannot be modified.
Container Repository
When creating a container image, the image of the container and its dependencies are stored in a local repository. These images can be reused many times on the host of the container without affecting either hardware or software resources. Container images can also be stored in a public or private registry, such as DockerHub, so they can be used on many different container hosts.

1. Types of containers for Windows Server 2016


When using the containers in Windows Server 2016 we have two types available that are:
Windows server containers
These containers offer application isolation through the process and name space isolation technology. A Windows server container allows you to share a kernel associated with the container host so that all containers running on this host can be used fully. The server container does not generate a security limit and it is not recommended to use to isolate some type of code that is not trusted.
Hyper-V isolation
This type of container allows to extend the isolation offered by the Windows Server Containers when each container is executed in a virtual machine with the necessary resources for its execution. With this type, the container host kernel is not shared with other containers on the same host thus increasing its performance.

With these concepts in mind we will see how to install the containers in Windows Server 2016.

Step 1

The most practical way to perform this task is through the Windows Server features that we can access in two ways:
  • Through the Server Manager by clicking on the “Add roles and features” line.
  • In the same Server Manager in the “Manage / Add roles and features” path.
Step 2

Then, in the window that appears, we go to the "Features" section and there we activate the "Containers" box: image
Step 3

Click Next and follow the steps of the wizard. Although this is the most practical method to install a container in Windows Server 2016, in most cases we find the following error.
For this reason TechnoWikis will explain the correct way to install the containers in Windows Server 2016 and thus significantly increase its productivity. image

2. Install Docker on Windows Server 2016


Docker is a container that serves to package and deliver the images of the selected container, this automated process results in images that can then be executed anywhere either locally, in the cloud or on a personal machine, such as a container.

To install Docker on Windows Server 2016 we will use the PowerShell OneGet module which works with the necessary providers to perform the installation being in the case of Docker the MicrosoftDockerProvider. This provider enables the container function on the server and also installs Docker, which requires a restart.

Remember that Docker is necessary to work with Windows containers and is designed with a Docker Engine and the Docker client.

Step 1

We will open a Windows PowerShell console as administrators and first of all we will install "Docker-Microsoft Package Management Provider" from the PowerShell gallery by running the following line:
 Install-Module -Name DockerMsftProvider -Repository PSGallery -Force 
Step 2

When executing this line we will see the following: image
Step 3

There we enter the letter S to confirm the download. In this case we will install NuGet which is a necessary provider to execute the Docker installation, after this we will be able to execute the command again and we will see that the Docker installation is done correctly: image
Step 4

The next step is to use the PowerShell “PackageManagement” module to install the latest version of Docker, for this we will execute the following:
 Install-Package -Name docker -ProviderName DockerMsftProvider 
image
Step 5

There we enter the letter S to confirm or the letter O to confirm everything and we will see that the installation process begins: image
Step 6

Finally we will see the following where it is indicated that a system restart is necessary: image
Step 7

We execute the restart of Windows Server 2016 by running the following line:
 Restart-Computer -Force 
Step 8

We can see that the system starts the process of configuring the updates. This will install Docker on Windows Server 2016.

image

Step 9

Some of the tasks we can perform later are. Verify the installed version:
 Get-Package -Name Docker -ProviderName DockerMsftProvider 
image
Step 10

See the current version:
 Find-Package -Name Docker -ProviderName DockerMsftProvider 
image
Step 11

Update Docker:
 Install-Package -Name Docker -ProviderName DockerMsftProvider -Update -Force Start-Service Docker 

3. Update the Windows Server 2016 Operating System

Before running Docker we will install the updates for Windows Server 2016, for this, from Windows PowerShell, we will execute the following command. There we enter the number 6 to start the process of downloading and installing the updates available for the system.

 sconfig 
image

4. Deployment of containers in Windows Server 2016


For this case we will download and run a .NET sample image previously created from the Docker Hub registry.
Step 1

This container will run a .Net Hello World application, for this we execute the following:
 docker run microsoft / sample-dotnet 
Step 2

The result will be as follows: image

As we can see, containers are a practical and useful alternative to the scalability of the operating system, offering integral solutions to manage new features.


by (3.5m points)
edited

Related questions

+3 votes
1 answer
+5 votes
1 answer
+3 votes
1 answer
+3 votes
1 answer
+3 votes
1 answer
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users