Windows containers are independent and isolated environments that run an operating system. These isolated environments allow you to place an application into its own container, thus not affecting any other applications or containers.
Think of containers as virtual environments that are used to run independent applications. They load much faster than virtual machines, and you can run as many containers as needed for all of the applications that you run.
One of the nice advantages of using Windows containers is that the containers can be managed the same way you manage an operating system. A container works the same way as a newly installed physical or virtual machine. So, once you know how to configure these containers, management is much easier than configuring a physical machine.
There are two different types of Windows containers:
Windows Server Containers This container allows you to isolate applications so they can run in their own space and not affect other applications. The question that you may be asking is, why not use a virtual machine? Well, the advantage of Windows Server containers is that they are already prebuilt and you don’t need all the other services that a virtual machine would need to run. So Windows containers are smaller, faster, and more efficient when isolating applications. In a Windows Server container, the kernel is shared between all the different Windows containers.
Hyper- V Containers Hyper- V containers and Windows containers work the same way. The difference between the two is that Hyper- V containers run within a virtual machine and the Windows containers don’t need to run in a Hyper- V environment. In a Hyper- V container, the container host’s kernel is not shared between the other Hyper-V containers.
Container Terminology
As with any new technology, it is important to understand the terminology that goes along with that new technology. The first thing that you may have noticed is that a container works a lot like a virtual machine. Just like a virtual machine, the container has a running operating system within the container.
The container, which has a filesystem, can also be accessed through the network the same way you access a virtual machine. The advantage is that a container is a more efficient operating system. But to truly understand how containers work, you need to understand all of the components that allow containers to function properly:
Container Host This component can be on a physical or virtual machine, and it’s the component that is configured with the Windows container feature. So the Windows container sits on top of the container host.
Container OS Image This component provides the operating system to the container. Containers are made up of multiple images that are stacked on top of each other.
Container Image This is the component that contains all the layers of the container. So the container image contains the operating system, the application, and all the services required to make that application function properly.
Container Registry This component is the heart and brain of the container. The container images are kept within the container’s registry. The advantage of doing containers this way is that you can download other registries to automatically add other applications or services quickly.
Docker Daemon This is the component that runs the Docker application. The Docker daemon is automatically installed after you complete the installation of the Docker application.
Dockerfile This component is used to create the container images. The advantage of using the Dockerfile is that you can automate how containers are created. Dockerfiles are batches of instructions (within a text file) and commands that are called on when an image is assembled.
Docker Hub Repositories This component is a location where all of your images are stored. By having a central location for stored images, the images can be used among coworkers and customers, or for the entire IT community. There are Docker hub repositories on the Internet where you can grab and use images for your organization.
Install and Configure Server Containers
So now that we have talked about the different components of a container, it’s time to look at installing containers on your Windows Server 2022 system. When it comes to Microsoft, it doesn’t matter if we are installing containers on a GUI- based system or non- GUI- based system. We are going to install the components needed by using Windows PowerShell.
But before we can look at installing and using containers, I need to show you what is required on the Windows Server 2022 system. So, the first step in using containers is looking at what we need on our network and computers for containers to run properly.
Requirements
Now that you have decided to work with containers, you must make sure that your network meets the minimum requirements to install and work with Windows containers:
■ The Windows container feature is available on Windows Server 2022, Windows Server (Semi- Annual Channel), Windows Server 2019, Windows Server 2016, and Windows 10 Professional and Enterprise Editions (version 1607 and later).
■ The Hyper- V role must be installed before running Hyper-V isolation.
■ Windows Server Container hosts must have Windows installed to C:. This restriction does not apply if only Hyper- V isolated containers will be deployed.
Here are the requirements if you are going to be running virtualization with containers:
■ For systems running the Hyper- V containers, the Hyper- V role must be installed on the system.
■ If you are going to run a Windows container host from a Hyper-V virtual machine (and also hosting Hyper- V containers), you will need to enable nested virtualization. Nested virtualization also has some requirements:
■ Operating system that allows nested virtualization (Windows Server 2022).
■ Minimum of 4 GB of RAM available to the virtualized Hyper- V host.
■ The processor needs to use Intel VT- x (this is only available for Intel processors).
■ Two virtual processors for the container host VM.