Everything the application depends on to run successfully can lives inside a container. Containers are an isolated, resource controlled, and portable runtime environment which runs on a host machine or virtual machine. An application or process which runs in a container is packaged with all the required dependencies and configuration files.
Containers grew up in Linux. In Windows Server 2016, containers can run on Windows and run Windows on the inside.
The idea is that you can run containers in the cloud, in the customer data center, or in container services and manage them consistently.
Windows Containers vs Linux Containers
Both Linux and Windows Server Containers are similar. Both types of containers implement similar technologies within their kernel and core operating system. The difference comes from the platform and workloads that run within the containers.
When you use Windows Server Containers, you can integrate with existing Windows technologies such as .NET, ASP.NET, PowerShell, and more.
Windows Containers vs Hyper-V Containers
Microsoft offers two containers types in Windows Server 2016: the Windows Server container and the Hyper-V container.
The two types function in the same way and can be created and managed identically. Where they differ is in the level of isolation each one provides.
Windows Server Containers provides operating system virtualization that separates your applications or services that are running on the same host. Each container has its own view of the operating system, processes, file system, registry, and IP addresses.
Hyper-V Container is a Windows Server Container running inside of a Hyper-V partition. Hyper-V Containers offer an additional deployment option between the highly efficient, high-density Windows Server Container and the highly isolated hardware-virtualized Hyper-V virtual machine. For environments where applications from different trust boundaries run on the same host, additional isolation may be required.
Docker Containers on Windows</h4>
Docker is a way to package up an app and push it out in a reliable and reproducible way.
Hyper-V Containers and Windows Server Containers provide the same level of integration and management with Docker. Jason Zaner, Microsoft Corp Vice President on Azure, explains, “the goal is to have an open, consistent, cross-platform experience.”
When to Choose Container Types
Containers are a way to wrap up an application into its own isolated box. For the application in its container, it has no knowledge of any other applications or processes that exist outside of its box.
As a developer you won’t really care which type will ultimately run.
Windows container images are common across both Windows Server Containers and Hyper-V Containers. The choice of container type is made when you start the container.
So Windows Server Containers and Hyper-V Containers are two flavors of the same thing rrom a developer viewpoint. Each container type offers the same development, programming and management experience, are open and extensible and will include the same level of integration and support via Docker.
A developer can create a container image using a Windows Server Container and deploy it as a Hyper-V Container or vice-versa without any changes other than specifying the appropriate runtime flag.
Deployment of Your ASP.NET Core Applications in Containers
You can even deploy your ASP.NET Core app:
- In Docker containers in both Linux and Windows.
- In Azure platform as a service using App Service on Linux, which now supports Containers and ASP.NET Core.
- In a Windows Container inside a Virtual Machine on premises or in a cloud service.
- In Azure Container Service (AKS).
- On AWS Elastic Container Service using these steps.
- On Google’s Kubernetes Engine using these steps.
The takeway is that your choice for deployment is made when it is time to publish.