+3 votes
391 views
How to install and configure containers in Windows Server 2019

in Windows Server by (552k points)
reopened | 391 views

1 Answer

+4 votes
Best answer

1. What are containers in Windows Server 2019
2. Types of containers for Windows Server 2019
3. Install the containers in Windows Server 2019
4. Validate the containers in Windows Server 2019
5. Use Windows PowerShell to install Docker on Windows Server 2019
6. Update Windows Server 2016
7. Use Docker in Windows Server 2019

One of the pillars that Microsoft has always wanted to print on its operating systems at the organization level, which we know as Windows Server, is the option that these are in the capacity to support the increase of current requirements and for this it must be with great performance of both hardware and software..

At the software level, the main core of Windows Server, we have a new technology called Container (Docker) which gives the possibility that as administrators or IT support personnel we are able to centrally manage all container issues , as well as the resources and tools available for each one.
Windows Server 2019 is the new bet that Microsoft launches for the management of business infrastructures and without a doubt that the containers will play a vital role to not only increase the capabilities of the server itself but to allow the organization as such to be able to increase its service levels

Through this tutorial, we will learn to install and containers in Windows Server 2019. To download Windows Server 2019, we can go to the following link:

Windows Server 2019

There we must register in the Windows Insider program for free to proceed with the respective download.


1. What are containers in Windows Server 2019


General containers have been developed in such a way that they are able to wrap an application in its own box in isolation.

This implies that each application in its respective container is not aware or aware of any other application or process that exists outside its box or environment, thus allowing everything that the application needs to make its operation the most appropriate. within that container and no additional element or configuration is required..

Where this box moves, the application will always be ready for use because there you will have the necessary tools for this purpose. A container can be defined in a few words as a runtime environment that meets the following characteristics:

  • Portable because we can move it from one place to another
  • Isolated because only that application will have the requirements and parameters necessary for its use
  • Controlled because as administrators we can define what type of action to execute
These containers can be executed on a host machine or virtual machine without any problem; Any application or process that is executed in a container is packaged with all the dependencies and configuration files necessary for its use, so this will not be a problem for our support tasks.

When we are in the world of containers there are certain elements that we must keep in mind for proper management, these are:

Container Host
It is basically the server where the Windows Container function has been configured. This container host will have the ability to run one or more Windows Containers simultaneously.
Container OS Image
Let us clarify that a container is deployed from images, that is, the image of the operating system of the container is the first layer of which a container is composed. This image is the one that delivers the operating system environment and as such this image is unmodifiable.
Sandbox
When the container is executed, all the actions performed on it are captured in this layer of 'sandbox' for subsequent administration tasks.
Container Image
It is normal that we make multiple changes to the original image of the container, the problem is that these changes are limited to a reduced environment. In some specific cases, we will be able to capture this state in order to create new containers that inherit these changes and thus avoid new editing tasks, this is the function and objective of an image, as soon as the container has been stopped, we can leave a side that sandbox or turn it into a new container image for other tasks.
Container Repository
When a container is created and edited, it creates a container image, the image of the container and its dependencies which are stored in a local repository. Container images can also be stored in a public or private record.

The following image is an official Microsoft graphic to understand how a container works:

image

2. Types of containers for Windows Server 2019


There are, for now, two types of containers to use in Windows Server 2019 that are:
Hyper-V Isolation - Hyper-V Isolation
With this type of container, the isolation offered by Windows Server 2019 Containers is extended by running each container in a virtual machine that is with the best optimization settings. There, the kernel of the container host is not shared with other containers on the same host, each of these containers has been designed to support multi-user hosting with the same security features of a virtual machine.
Windows Server Containers - Windows Server Containers
This type of container offers application isolation through the Windows Server 2019 namespace isolation process and technology. A Windows Server container shares a kernel with the container host and all containers running on the host. simultaneously.

3. Install the containers in Windows Server 2019

Step 1

To start, we will access the installation option using one of the following options:
By clicking on the “Add roles and features” line from the central panel of the Server Manager
Right there, go to the menu “Manage / Add roles and features” image
Step 2

There the following assistant will be displayed: image
Step 3

In it we find a brief summary of the activities that we can carry out, we click on Next and in the next window we select the “Installation based on features or roles”: image
Step 4

In the next window we select the server that will act as host for the containers: image
Step 5

In the next window we will see the Roles section for the server, in this case we will not add any role: image
Step 6

Click on Next and in the Characteristics section we activate the “Containers” box: image
Step 7

Click on Next and we will see a summary of the feature to be installed on Windows Server 2019: image
Step 8

Click on the "Install" button to start the process of installing containers in Windows Server 2019: image
Step 9

Once the installation process is finished we will see the following: image
Step 10

There we must restart Windows Server 2019 to apply the respective updates:

image


4. Validate the containers in Windows Server 2019


The previous method is the suggested process to install the container feature in Windows Server 2019 but if we go to the command prompt and run the following line we can see that it results in an error.

This error is basically due to the fact that the containers must use Docker. Docker has been developed as a container which has the task of packaging and delivering the images of the selected container, so that this automatic process results in the images that we can later execute anywhere in the local area, in the cloud or in a private container-shaped machine.

 docker run microsoft / sample- dotnet 
image

5. Use Windows PowerShell to install Docker on Windows Server 2019


In order to install Docker on Windows Server 2019, we will need to make use of the Windows PowerShell OneGet module, which acts with the necessary providers in order to execute the installation, in the case of Docker, of the MicrosoftDockerProvider, this provider enables the container function on the server as such and installs Docker integrally.
Step 1

To run this, we open Windows PowerShell as administrators and there we run the following line:
 Install-Module -Name DockerMsftProvider -Repository PSGallery -Force 
Step 2

When we press Enter we will see the following. We enter the letter S to install and import the NuGet provider in Windows Server 2019. image
Step 3

Next, we will make use of the “PackageManagement” module of Windows PowerShell with the aim of installing the latest version of Docker, for this we will execute the following line:
 Install-Package -Name docker -ProviderName DockerMsftProvider 
image
Step 4

Again we enter the letter S or the letter O to confirm everything, this to confirm the download and installation of the latest version of Docker: image
Step 5

To complete all the changes we will restart the system by executing the following:
 Restart-Computer -Force 
Step 6

Once the system is loaded again we will carry out some Docker control tasks. To check the version of Docker that has been installed we will execute the following:
 Get-Package -Name Docker -ProviderName DockerMsftProvider 
image
Step 7

If we want to validate the current version of Docker, just run the following:
 Find-Package -Name Docker -ProviderName DockerMsftProvider 
image
Step 8

In case of having an outdated version we can update it by executing the following commands:
 Install-Package -Name Docker -ProviderName DockerMsftProvider -Update -Force Start-Service Docker 

6. Update Windows Server 2016

Step 1

For optimal use of Docker it is ideal to update the operating system, although the traditional method is through Windows Update, we can run it much faster using the sconfig command either through the command prompt or Windows PowerShell, the following will be displayed : image
Step 2

There we enter the number 6 and in the next window we can select among the recommended or all updates: image

7. Use Docker in Windows Server 2019

Step 1

Now, we can download and run a .NET sample image which is available in the Docker Hub registry at the following link:
Docker
Step 2

Then we will run the following from Windows PowerShell:
 docker run microsoft / sample-dotnet 
Step 3

The result will be as follows: image

We can see how containers are a great alternative to further expand the use of Windows Server 2019..


by (3.5m points)
edited

Related questions

+4 votes
1 answer
asked Oct 25, 2019 in Windows Server by backtothefuture (552k points) | 365 views
+3 votes
1 answer
+3 votes
1 answer
asked Oct 14, 2019 in Windows Server by backtothefuture (552k points) | 330 views
+5 votes
1 answer
+5 votes
1 answer
asked Oct 24, 2019 in Windows Server by backtothefuture (552k points) | 264 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users