GP - Fotolia
Why Linux containers on Windows is a big deal
Microsoft introduced support for Docker Linux containers in its latest versions of the Windows client and server operating systems, so why should it matter to you?
Although it's tempting to think that a container is just a container, there are key differences between Linux and Windows containers.
Windows has more strict requirements on image compatibility, particularly regarding the operating system. Some networking features on Docker on Linux are not available for Windows, and similarly for orchestration.
With these limitations, why would you want to run Linux containers on Windows? For one, containers allow you to be agnostic on the host system. Whether you're running Linux or Windows on the host, and whether that's in production or not, it won't matter to the container. You can run Windows in the development environment, stage it in Linux and deploy to production on either system. By allowing your Windows hosts to run Linux or Windows containers, you keep the developers free to do their jobs without having to factor in variables, such as the host operating system.
Linux containers on Windows offers several advantages
The biggest benefit of this expanded functionality is Linux and Windows containers can run from the same Docker engine, which is a recent development. This feature lets you standardize your tool set across your environment, provide parity between production and nonproduction systems, and can collapse infrastructure costs by using one machine to host multiple types of containers.
Deploying Linux containers on Windows encourages you to build your applications as microservices using Windows or Linux containers. It's encouraging to see a technology give users across the spectrum a way to choose the container they prefer for development. A key difference when using Windows Server containers is having access to certain technologies on the Windows platform, such as PowerShell. There are also benefits to using the .NET Framework with Windows containers.
Limitations of Linux containers on Windows
Not all Windows versions are supported, so your developers will need to be on the correct version of Microsoft's operating system for Linux containers to work properly on their machines. In addition, if you're running containers on premises, you'll need to pay careful attention to which servers have the appropriate prerequisites and operating systems installed.
You can read more on the requirements for containers here.
What's needed to run Linux containers on Windows
Before you can proceed with the instructions below, you'll need:
- a machine running Windows 10 Professional or Enterprise, or Windows Server 2019 version 1809 or later;
- Hyper-V enabled; and
- Docker Desktop 18.02 or later installed.
How to run a test container
To run your first Linux container on Windows, you'll need to start by getting a Linux Docker image. For our purposes, we'll use the "Hello World" example container. You can run this by executing the following command:
docker run --rm --platform linux busybox echo hello_world
This command pulls the image with the indicated platform via the --platform flag.
To run the image, enter the following command:
docker run --rm busybox echo hello_world
To view a list of your images, you can run the next command to see the image you've pulled:
Where do we go from here?
That's all it takes to run Linux containers on Windows. Of course, there's much more to learn with this type of virtualization, such as understanding how to manage clusters of Docker nodes and getting familiar with Kubernetes to automate the deployment and management of containers.
If you're using Windows on your development team and your team prefers to use Linux containers, then this is all excellent news for you. You can continue with your operating system of choice but also participate in all the neat things used by your developers. Additionally, if you're an operations expert trying to wade your way through the plethora of container deployment methods, you can rest easy knowing that you can implement all these container types from a Windows machine.