Deploy Docker Windows Containers on Windows 2019 / 2022

Deploy Docker Windows Containers on Windows 2019 / 2022. In this post, we will introduce Docker, it’s benefits then explain how to deploy Docker windows server container on Windows server 2019 / 2022.

First of all, Docker is a professional tool that enables developers to operate, write and bundle programs for container deployment. Altogether a powerful software that offers multiple benefits and features for DevOps teams.

The software methodologies for shipping, testing, and deploying code rapidly minimize delays in writing and running code in production.

But does it offer advantages and features that can streamline your DevOps processes?

Let’s find out with how to Deploy Docker Windows Containers on Windows 2019 / 2022.

What is Docker?

All in all, Docker is an open platform for functioning, developing, and shipping applications. It enables users to package programs into containers. Basically, Docker is an excellent utility for running and packaging. As a result, you can build standard constraints that include multiple components required to function in isolation.

Another key point about Docker is that technically a container management software developed in 2013. Also, it helps developers handle the framework as if they are handling applications.

Certainly, it gained popularity in the cloud packaging and application world. More with Docker is that you also automate application deployment in portable and lightweight containers.

How does Docker work?

Well, the docker packages, provisions, and runs containers. Thus, container technology is available through the operating system, and each container shares the services with the underlying OS.

Another fact about Docker, is that it runs different containers on a similar OS using the kernel’s resource isolation. As a matter of fact, it makes it different from virtual machines, which focus on encapsulating the OS with executable code on the physical hardware.

The tool images have the dependencies required to execute the code within the container. Containers operate with no changes that pass between Docker environments with the same operating system.

As an example, it works on Linux but offers excellent support for non Linux OS, including Microsoft Windows and Apple OS. Developers can also access the Docker versions for Amazon Web Services and Microsoft Azure.

Features of Docker

So, docker gives you multiple features, but here are a few important ones to help you better understand.

  • Quick configuration: Offers easier and quick configuration and helps create an isolated application management environment.
  • Effective management: Reduces the infrastructure and maintenance costs to help you save expenses and improve your core business operations.
  • Offers scalability: Simple to scale and achieve your business outcomes with finesse.
  • Simple modelling with Docker.
  • Great operational capabilities: Has an operational efficiencies to remove multiple hiccups that occur during management.
  • Isolated environment is offered for multiple administrative applications.

These Docker features can offer multiple benefits to businesses according to their goals, requirements, and multiple other factors.

Advantages of Using Docker

Out of multiple benefits, here are the best ones.

Fast and consistent

Certainly, Docker simplifies the development lifecycle, by enabling developers to work in standardized environments using local containers. As noted, containers are good for continuous integration and delivery  (CI/CD) workflows.

Look at the following example scenario:

  • Developers write code locally and share the work with their colleagues using Docker containers.
  • They use Docker to process their applications in a test environment and execute manual and automated tests.
  • When developers spot bugs, they can rectify them in the development environment and deploy them to the test environment.
  • Once the testing is complete, providing the fix to the customer is pushing an updated image to the production environment.
  • The reliability and quickness provided are excellent compared to other tools.

Responsive scaling and deployment

Consequently, Docker’s container based platform enables highly portable workloads. The containers run on your local laptop or a physical or virtual machine in a data center.

They can also run on different cloud providers or in multiple other environments. Docker’s lightweight nature and portability make it easy to effectively manage workloads, scaling up or tearing down services and applications.

Run more workloads

Equally, Docker is lightweight and fast. Run more workloads on the same hardware. Especially, it provides a cost effective, viable alternative to hypervisor based virtual machines to use more of your server capacity for desired results. Hence, Docker is great for high density environments and medium or small deployments where you must do more with fewer resources.

Overall, a great tool that aids in your continuous deployment process. It’s well integrated with different configuration management software. The developing and large ecosystem of Docker has a wide range of applications.

Prerequisites

  • A user with administrative privileges.
  • Minimum 4 GB of RAM with 2 Cores CPU.

Install Containers Features in Windows Server 2019 / 2022

To run containers natively in Windows, you will need to install the Windows server container features on your server. Follow the below steps to install the containers features:

Step 1 – Open the Windows server manager. You should see the following screen:

Step 2 – Click on the Add roles and Features Wizard. You should see the “Before You Begin” screen:

Step 3 – Click on the Next button. You should see the Select Destination Server screen:

Step 4 – Click on the Next button. You should see the Select feature screen:

Step 5 – Select the Containers features and click on the Next button. You should see the confirm installation selection screen:

Step 6 – Click on the Install button to start the installation. You should see the following screen:

Step 7 – Once the installation is complete, click on the Close button to exit the installation wizard.

Install Hyper-V Roles

You will also need to add the Hyper-V roles to use the Hyper-V isolation. Follow the below steps to add the Hyper-V roles:

Step 1 – Open the Windows server manager. You should see the following screen:

Step 2 – Click on the Add roles and Features Wizard. Then, click on the Next button.

Step 3 – In the Select server roles screen, select the Hyper-V roles and click on the Next button. You should see the following screen:

Step 4 – Click on the Next button. You should see the Create Virtual Switches screen:

Step 5 – Click on the Next button. You should see the Virtual Machine Migration screen:

Step 6 – Click on the Next button. You should see the default stores screen:

Step 7 – Click on the Next button. You should see the confirm installation selection screen:

Step 8 – Click on the Install button to start the installation. After the successful installation, restart your system to apply all the changes.

Next part of Deploy Docker Windows Containers on Windows 2019 / 2022 is to Install Docker.

Install Docker on Windows Server 2019 / 2022

First, you will need to install the DockerMsft provider to install the Docker on your server. Open your Windows PowerShell and run the following command to install the DokcerMsft provider:

				
					Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
				
			

After installing DockerMsft Provider, run the following command to install Docker:

				
					Install-Package -Name docker -ProviderName DockerMsftProvider
				
			

You will need to allow the installation as shown below:

Type Y and press the Enter key to install Docker.

Once the Docker is installed, restart your system to apply the changes.

Run Windows Server Container

First, you will need to pull the Windows server 2022 image from the Docker registry. Open your Windows PowerShell and run the following command to pull the image:

				
					docker pull mcr.microsoft.com/windows/servercore:ltsc2022
				
			

Once the image is downloaded, run the following command to create a container from the downloaded image:

				
					docker run -dit mcr.microsoft.com/windows/servercore:ltsc2022
				
			

Once the container is created, you can verify the running container using the following command:

				
					docker ps
				
			

Thank you for reading Deploy Docker Windows Containers on Windows 2019 / 2022. We shall conclude.

Deploy Docker Windows Containers on Windows 2019 / 2022 Conclusion

In this post, you learned how to deploy Docker Windows Server container on a system running Windows Server 2019 / 2022. You can now easily deploy your application in the containerised environment.  Lastly, Docker allows you to isolate applications from a local infrastructure. This makes software deployment faster, easier and more secure than ever before.

Also, Docker offers multiple benefits to help you construct containerized and multi container apps. You can use Docker to streamline your DevOps operations, but before that, don’t forget to understand its architecture.

Read more about Docker in our blog over here

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x