Can I use Docker on Windows?

Source: Internet
Author: User

Chen Festival
Personal blog: https://blog.jijiechen.com/post/docker-on-windows/

Docker, or, to be exact, container technology has almost become the default technology for application distribution and cluster deployment in recent years. Background section, if interested, refer to the Chat Cluster Management mode article. The maturation of the Docker ecosystem is also dependent on the rise of its peripheral tools and practice models. For example, the springing up of choreography techniques, as well as the development of DEVOPS practices based on container technology, are on a large scale.

So good technology, can you use it on Windows? On various occasions, there are people who discuss this topic with me. Every time I hear such a question, I am also very helpless. After all, as long as a little search, it is not difficult to answer: yes. But it makes sense to think about it: Docker, after all, is a technology that originates from Linux.

Docker is a lightweight virtualization technology that is abstracted from system-wide isolation mechanisms such as Namespace and CGroup built into Linux. It provides a lightweight way to isolate the running space compared to a virtual machine. If a 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, does not provide another kernel (Windows) virtualized operating environment based on one kernel (Linux). Therefore, Linux-based Docker is not supported for running Windows apps.

Prior to Docker, Linux provided the basic technologies that today's Docker uses. When Docker seemed to be suddenly hot all over the world, the technical accumulation was not instantaneous. It all seems a bit lag on Windows. While Docker is well known, Windows systems do not have a similar mechanism at all, let alone Windows-specific toolchain and practices. So, we see that the intersection of early Windows and Docker just provides an application development environment for them.

Boot2docker with Docker for Windows

The desktop experience of Windows development for Docker-deployed applications--windows is much better than Linux, so a project that runs Docker as a virtual machine on a heterogeneous operating system appears, that is, Boot2docker. It supports both Windows and MacOS.

Later, Docker started rolling out its own Docker for Windows Toolkit, which was designed to provide a complete toolchain for developers to develop Docker-oriented applications on Windows, including running environments, clients, Docker Swarm orchestration tools, and other Tools. The tool that is responsible for running the environment configuration in Docker for Windows is Docker machine. Similar to Boot2docker, Docker machine creates a Linux VM on Windows to run the Docker engine. In other words, This environment is only supported for LINUX application formats and does not support the operation of Windows applications.

Windows Container Technology

The Windows system also found the importance of container granularity as the world's container technology for the Linux world was scraped through the east wind of Docker. Microsoft and Docker announced cooperation in 2014 to bring container technology to the Windows Server operating system and to provide more direct support for the containerized transformation of traditional Windows applications. Shortly after, Microsoft announced on Ignite 2015 that it would launch a Windows Nano Server optimized for containers; The first Windows container really meets with developers on the annual update for Windows 10 (2016.8), which formally provides the Windows container Development environment. The release of Windows Server 1709, released in October 2017, contains the Windows container, which means that the technology can be used in production environments. Windows containers are container technologies that are truly capable of running Windows applications , including applications that rely on IIS, the registry, and many other Windows features to run in Windows containers.

While Windows support for containers is a bit belated, the community's focus and use of Windows containers is unusually active. This is mainly due to the container technology itself, the ecological maturity, one of the technology has been fully recognized, while the surrounding tools and practices have become more perfect. On the other hand, in the process of building this technology with Docker, we are also aware of the compatibility with existing technologies. After the Windows Container feature is enabled on the computer, the next steps are still done based on the Docker client, and there is no difference between the command line parameters and the Docker on Linux.

Almost as the process of Windows container technology itself matures, the peripheral tools support for Windows containers is also well-synchronized. Docker for Windows adds a thoughtful menu to the new version, with the ability to switch between Linux containers and Windows containers in one click, and Kubernetes to add support for Windows containers from version 1.5, including Azure and AW, in the cloud environment Many cloud environments, including S, provide the support of the Windows container for the first time ...

Windows Container Schema

How does Windows provide both its own container technology and the Docker-compatible operating interface? The following diagram on the left is the architecture of the Linux container, and the right side is the Windows container. It can be found that the two structures are similar. Similar to Linux, Windows also new abstracts out the concepts of CGroup and Namespace and provides a new level of abstraction Compute service, the host Compute Service,hcs. HCS is designed to provide a more stable interface for external (such as Docker engines), compared to the implementation details that may be often refactored at the bottom. HCS's operating interface is currently available in the Go language version, and the C # language version, which is currently used by the Docker client to manipulate Windows containers.

In terms of container mirroring, Microsoft provides its own server Core and the Nano server version of two servers. Server Core understands that Windows server has stripped down the GUI parts, so the functionality is more complete (including features such as file servers, DNS servers, etc.) while the mirror size is larger (2GB~5GB), while Nono Server is a mini-system optimized for containers Only the core Windows Server features, with a mirror size of (130MB~400MB). The method of building your own image based on the underlying image is the same as the Linux image, so the format and syntax of the DockerFile file are not different. As far as authorization is concerned, Microsoft does not charge the user a license fee for container mirroring as long as the user has obtained authorization for the host.

Summary

The container technology itself, along with a range of tools and practices around it, standardizes application packaging and publishing to a large extent by eliminating the application's reliance on a particular environment, thus providing a powerful guarantee for efficient clustering of deployments and operations. As a representation of container technology, Docker can run on Windows in two forms: a container running Linux in the form of a Hyper-V virtual machine, or running a native Windows container. The former runs the Linux-formatted application, which can run Windows applications. If you use a little bit of finesse, you can also make both of them run on Windows computers at the same time.

Windows 10 and Windows Server both provide support for Windows containers, and support for Windows containers is becoming more and more complete with various containerized tools. Windows-based development of new applications can prioritize cross-platform containerized deployments and, on the other hand, can be considered as containerized, cloud-native with Windows container technology, as is the case with stock applications.

Can I use Docker on Windows?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.