docker virtualization windows server

Install Docker on Windows Server 2019 – 4sysops

On this collection, we’ll try to type out complicated subjects corresponding to Docker Engine Enterprise Edition (EE) vs. Docker Enterprise, Docker Engine Group Version (CE) vs. Docker Desktop, dockerd vs. docker vs. containerd vs. runc, and so on.

Swapnil Kambli

Swapnil Kambli is a cloud marketing consultant and coach specializing in cloud adoption, migration, help, and optimization. He has 14 years of expertise advising enterprises in areas ranging from containers to server management, virtualization to cloud computing, automation to DevOps, system administration to site-reliability engineering, and methods administration to governance.

Latest posts by Swapnil Kambli (see all)

We’ll also try to perceive the present state of Docker on Windows by demystifying the variations between the Docker experience on Windows and Linux. In in the present day’s article, we’ll start with launching our first Windows container on Windows Server 2019, and along the best way, we’ll undergo a number of the current points of Docker on Windows.

When Docker first released a containerization product, they started with Linux as a base platform. In 2014, Docker and Microsoft announced partnership to offer a consistent platform to construct, ship, and run any software. On Windows Server 2016, Docker and Microsoft got here out with container know-how that offered a constant experience throughout both Linux and Windows Server environments.

In 2017, they launched Docker Swarm with the power to create combined Windows Server and Linux clusters. In 2018, this launch adopted with added help for the Semi-Annual Channel (SAC) Windows Server 1709 and 1803 variations. With Windows Server 2019 (the 1809 build), Microsoft managed to deliver the containers to Windows on par with containers on Linux methods.

At current, hundreds of enterprise clients are extensively utilizing Docker on Windows in manufacturing environments. Nevertheless, there’s all the time been a delicate performance difference between Windows containers and Linux containers. Microsoft Windows Server is closing that hole quickly with new releases.

Install the Hyper-V function ^

On Windows platforms, you’ll be able to run containers in two modes: course of isolation and Hyper-V isolation. In process isolation mode, containers share the OS kernel with the host and therefore are light-weight and just like how containers work on Linux techniques.

Conversely, in Hyper-V isolation mode, each container runs inside a particular minimal virtual machine. Thus, it supplies safe kernel-level isolation and enhanced compatibility. You’ll want to enable Hyper-V within the host OS to run containers in Hyper-V isolation mode.

Once we set up Docker on a Windows server, the default mode of operation is process isolation. And enabling Hyper-V is non-compulsory. Nevertheless, if we have to run Linux containers, enabling Hyper-V is required.

The second factor that determines whether to go for the Hyper-V function is the OS build. Windows containers have to have the same construct version because the model of the container host OS they run on. Container photographs tagged as 1809 would work on the newest 1809 Windows version builds. Nevertheless, if we’ve got constructed container photographs on a lower model of Windows than the container host OS, we will run these containers with Hyper-V isolation, which requires enabling Hyper-V.

You possibly can set up Hyper-V on Windows Server utilizing the PowerShell command under:

Additionally, we need to notice right here that we will change between course of isolation and Hyper-V isolation during runtime using the parameter isolation whereas spinning up Docker containers.

Container host conditions ^

Though this text’s scope is for Windows Server 2019 (1809), the steps demonstrated here might also very nicely apply to different Windows Server builds, including Windows Server version 1803, Windows Server model 1709, and Windows Server 2016.

If you wish to use Hyper-V isolation in your container, you might want to allow virtualization in the hosting platform. If the container host is operating on hardware, you’ll want to enable the hardware virtualization function, corresponding to Intel VT-x, in BIOS. And if the container host is operating from Hyper-V or from a cloud setting, it’s essential enable nested virtualization within the base platform.

Install the containers function ^

For containerization to work, you might want to install the Windows container function on the Windows container host. Use the command under to put in the containers function and reboot the computer.

Install the Containers feature

Install the Containers function

Install Docker ^

Docker consists of two main elements: the Docker engine and the Docker shopper. The Docker engine is on the market in two editions: Docker Engine CE and Docker Engine EE. The Docker Engine CE is a free product. Conversely, the Docker Engine EE requires a license. The diagram under illustrates the architectural difference between the two.

Docker Engine architecture

Docker Engine architecture

From a user-experience perspective, Docker supplies two units of products or packaged bundles: specifically, Docker Desktop and Docker Enterprise.

As for Docker Desktop Group/Enterprise, they designed this product set contemplating developers and a improvement setting in thoughts. Docker Desktop offers an installation wizard, a administration UI, and a number of other different utilities for enhancing deployment. Docker Desktop is supported on Windows 10 and Mac. Docker Desktop comes with the Docker Engine CE or EE relying on the product tier we select.

Docker targets its enterprise product suite towards production environments. This consists of the Docker enterprise engine together with its certified plug-ins, well-integrated product line, and trusted repositories. General, it aligns with the enterprise necessities for use in a manufacturing surroundings.

On this article, we’re going to install Docker Engine EE on Windows Server 2019. To get the complete performance of the EE edition, we have to purchase the EE license from Docker.

The process for installing Docker EE on Windows Server is sort of simple with the introduction of the OneGet provider PowerShell Module. As a first step, install the Docker-Microsoft PackageManagement Supplier module from the PowerShell Gallery.

Install the Docker package provider

Install the Docker package deal provider

We will use the commands under to view the installed package deal supplier and the Docker package deal made obtainable via it.

Display the installed package provider

Display the put in package deal supplier

Next, we’ll use the PackageManagement PowerShell module command Install-Package deal to put in the newest model of Docker.

Install the Docker package

Install the Docker package deal

Docker verification ^

After putting in the Docker package deal and we’ve our command prompt back, we need to start the Docker service using the command under.

Once we run the Docker service for the primary time, it creates a digital change/interface viewable by way of our Control Panel pane.

Installed network virtual switch

Installed community virtual change

Also, we will verify the Docker virtual community creation using the Docker command under. The default identify of the bridge or change in a Windows setting is NAT.

List Docker networks

Record Docker networks

This digital change lays the inspiration of networking for containers to communicate with each other as well as speak with the container host.

Subsequent, we will run the Docker model command to examine the small print of our deployment setup. We will confirm the Docker engine and shopper version from the command output.

Check the Docker version

Verify the Docker model

And lastly, to verify the Docker client-engine communication is working positive and set up is complete, run the command docker information. This supplies us with system metadata together with the present container stats.

Check system container info

Examine system container information

Launch a Windows container on Windows Server 2019 ^

Now that we now have completed the installation and verified every thing is working smoothly, it’s time to run our first Windows container on Docker.

Right here we need to contemplate two elements. First, we will create Windows container photographs with 4 container base pictures: Windows Server Core, Nano Server, Windows, and IoT Core.

Once we spin a container from these pictures, we have to confirm the compatibility between the container host OS and the container base image. In other phrases, containers based mostly on Windows Server Core, Nano Server, or Windows as the base image can run on a Windows 2019 container host. Nevertheless, a container based mostly on an IoT Core picture can’t run on Windows Server 2019. An IoT Core container requires Windows IoT Core as a container host.

Second, to repeat, Windows containers have to match the model of the container host OS. Container pictures with the 1809 tag work with the newest Windows variations. Nevertheless, if we’ve got container photographs built on a decrease version of Windows than the container host OS, we will run these containers with Hyper-V isolation

Contemplating these two elements, let’s verify the construct version of our container host.

Check the Windows version

Verify the Windows model

Because the container host build version is 1809, let’s try to download a Nano Server picture from the Microsoft picture/container registry to the native machine.

Pull a Docker Nano Server image

Pull a Docker Nano Server image

We will confirm the regionally out there image along with its metadata info, akin to measurement, picture ID, and creation date.

List locally available images

Listing regionally out there photographs

We will use the downloaded picture for baking our software into it and creating a new container. However for simplicity, let’s launch a primary container that may run just a simple command inside the OS and exit.

Create and run a Docker container

Create and run a Docker container

This command created a brand new container from the Windows Nano Server image, and the container outputted the machine identify of the container, a random ID set by Docker. To see more details about the container we created just now, run the command under.

List Docker container information

Listing Docker container info

Thus, we now have launched a Windows container on Windows Server 2019, contemplating a few of the elements for Docker on Windows. In the next article, we’ll talk about Linux containers on Windows (LCOW), LinuxKit, Windows Subsystem for Linux 2 and learn how to run your first Linux container on Windows Server 2019.

Are you an IT pro? Apply for membership!


Users who have LIKED this publish:

  • avatar