Docker, or rather container technology, has become almost the default technology for application distribution and cluster deployment in recent years. In the background section, if you are interested, please refer to the article Chat Cluster Management Mode. The maturity of Docker ecology also depends on the rise of surrounding tools and practice modes. For example, choreography technologies have mushroomed, and DevOps practices based on container technologies have taken off on a massive scale.

So does this technology work on Windows? On various occasions, people discuss this topic with me. Every time I hear such questions, I am also very helpless. After all, with a little searching, it’s not hard to answer: Yes. But if you think about it more deeply, it makes sense: Docker originated as a technology on Linux, after all.

Docker is a light virtualization technology based on Linux built-in Namespace and CGroup system isolation mechanism. Compared to virtual machines, it implements isolation of running space in a lightweight way. If the physical machine is a residential building, the virtual machine is a suite in the building, and the container technology is a partition in the suite. It is not difficult to understand that Docker, as a partition, cannot provide a virtualized operating environment based on one kernel (Linux) and another kernel (Windows). Therefore, Linux-based Docker does not support running Windows applications.

Long before Docker, Linux provided the basic technologies used by today’s Docker. Behind the sudden popularity of Docker around the world overnight, the accumulation of technology was not instantaneous. All this is lagging behind on Windows. While Docker was well known, Windows had no such mechanism at all, let alone a Toolchain and practices unique to Windows. So, we see that the early intersection of Windows and Docker was just to provide an application development environment.

Boot2docker with Docker for Windows

Docker-oriented applications can be developed on Windows — Windows has a much better desktop experience than Linux, so early on there was a project to run Docker as a virtual machine on a heterogeneous operating system, boot2Docker. It supports both Windows and macOS.

Later, Docker company began to launch its own Docker for Windows toolkit, which aims to provide a complete tool chain for developers to develop Docker-oriented applications on Windows, including operating environment, client, Docker Swarm orchestration tools and other tools. Docker for Windows is responsible for the runtime environment configuration tool is Docker Machine. Similar to boot2Docker, Docker Machine will also create a Linux VIRTUAL Machine on Windows to run the Docker engine. That is, the environment only supports Linux application formats, not Windows applications.

Docker for Windows (Docker for Windows)

Windows Container Technology

While Container technology in the Linux world is sweeping the world with the help of Docker, Windows systems are discovering the importance of container granularity.

Microsoft and Docker announced a partnership in 2014 to bring container technology to Windows Server and provide more direct support for the containerization of traditional Windows applications. Shortly after, Microsoft announced at Ignite 2015 that it would launch Windows Nano Server optimized for containers; The first time Windows Container was really introduced to developers was in the Windows 10 annual Update (2016.8), which officially provided the Windows Container development environment. The Release of Windows Server 1709 in October 2017 included Windows Containers, meaning the technology is now available in production environments. Windows container is a real container technology that can run Windows applications, including applications that rely on IIS, registries and many other Windows features can run in Windows containers.

While Windows container support has been somewhat late, the community’s interest in and use of Windows containers is very active. This is mainly due to the ecological maturity of container technology itself. As a result, people have a full understanding of this technology, and the surrounding tools and practices have become increasingly perfect. On the other hand, in the process of building this technology together with Docker, we also paid attention to the compatibility with existing technologies. After Windows Container is enabled on the computer, the following steps are still done based on the Docker client, and the command-line parameters are no different from the Docker on Linux.

Almost at the same time that Windows container technology itself is maturing, the support for Windows containers by peripheral tools is also improving. Docker for Windows adds a thoughtful menu that lets you toggle between Linux containers and Windows containers with one click; Kubernetes adds support for Windows containers starting with version 1.5; On the cloud side, many cloud environments including Azure and AWS are providing Windows container support for the first time…

Windows Container Architecture

How does Windows provide both its own container technology and a Docker-compatible interface? The diagram below shows the architecture of a Linux container and the diagram below shows the architecture of a Windows container. You can see that they are very similar in structure. Similar to Linux, Windows abstracts the concepts of CGroup and Namespace and provides a new abstraction level Compute Service, Host Compute Service (HCS). HCS is designed to provide a more stable operating interface for external entities (such as Docker engines) than the low-level implementation details that may often be refactored. The operation interface of HCS is currently available in Go language version and C# language version. The former is currently used to operate Windows containers in Docker client.

(Image from Black Belt’s DockerCon presentation: Docker and Windows Containers Revealed)

In terms of container image, Microsoft provides two Server versions, Server Core and Nano Server. Server Core can be understood as Windows Server without the GUI part, so that the functions are more complete (including file Server, DNS Server, etc.), and the image size is larger (2GB~5GB). Nono Server, on the other hand, is a miniaturized system optimized for containers, containing only the core Windows Server features and image sizes (130MB to 400MB). The way to build your own image based on the base image is the same as Linux images, so the format and syntax of the DockerFile file is not different.

As for authorization, as long as the user has obtained the authorization of the host, Microsoft will not separately charge the user the authorization fee of the container image.

summary

Container technology and the tools and practices surrounding it standardize the packaging and distribution of applications, largely eliminating the dependency of applications on specific environments, and thus providing a strong guarantee for efficient clustered deployment and operation. As an example of container technology, Docker can run on Windows in two forms: a Linux-formatted container as a Hyper-V virtual machine, or a native Windows container. The former runs Linux-formatted applications, while the latter can run Windows applications. With a little finesse, you can make both run on Windows machines at the same time.

Both Windows 10 and Windows Server provide support for Windows containers, and various container tools are improving their support for Windows containers. When developing new applications based on Windows, on the one hand, we can give priority to the ability of cross-platform container deployment. On the other hand, we can also consider the containerization and cloud native features of Windows container technology as well as stock applications.


For more insights, please follow our wechat official account: Sitvolk

WeChat
Sina Weibo
Evernote
Pocket
Instapaper
Email
LinkedIn
Pinterest