Docker and Windows containers

Docker was originally developed on Linux, taking advantage of core Linux features, but making it simple and efficient to use containers for application workloads. Microsoft saw the potential and worked closely with the Docker engineering team to bring the same functionality to Windows.

Windows Server 2016 was the first version of Windows built to run Docker containers; Windows Server 2019 continues the innovation with significantly improved features and performance for Windows containers. You can run the same Docker containers on Windows 10 for development and testing that you run on Windows Server in production. Right now, you can only run Windows applications in containers on Windows, but Microsoft is adding support for Linux application containers to run on Windows too.

The first thing you need to know is that there is no integration between containers and the Windows UI. Containers are only for server-side application workloads, like websites, APIs, databases, message queues, message handlers, and console applications. You can't use Docker to run a client app, like a .NET WinForms or WPF application, but you could use Docker to package and distribute the application, which would give you a consistent build and release process for all your apps.

There's also a distinction between how containers run on Windows Server 2019 and Windows 10. The user experience for working with Docker is the same, but the way containers are hosted is different. On Windows Server the process that serves your application actually runs on the server, and there's no layer between the container and the host. In the container you may see w3wp.exe running to serve a website, but that process is actually running on the server – if you had 10 web containers running, you would see 10 instances of w3wp.exe in Task Manager on the server.

Windows 10 doesn't have the same operating system kernel as Windows Server 2019, so in order to provide containers with the Windows Server kernel, Windows 10 runs each container in a very light VM. These are called Hyper-V containers, and if you run a web app in a container on Windows 10, you won't see w3wp.exe running on the host – it actually runs inside a dedicated Windows Server kernel in the Hyper-V container.

This is the default behavior, but in the latest versions of Windows and Docker you can run Windows Server containers in Windows 10, so you can skip the extra overhead of running a VM for each container.

It's good to understand the distinction between Windows Server containers and Hyper-V containers. You use the same Docker artifacts and the same Docker commands for both, so the procedures are the same, but there is a slight performance hit in using Hyper-V containers. Later in this chapter, I'll show you the options for running Docker on Windows, and you can choose the best approach for you.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.80.45