Developer, architect or engineer: Which tech job pays best? Watch Now

Windows Subsystem for Linux 2 (WSL2) has brought the Linux kernel to Windows. Does that really matter, you might ask, since WSL already did an excellent job of emulating Linux? Oh yeah it does. It matters a heck of a lot, according to Docker Senior Software Developer Simon Ferquel.

In an engineering blog, Ferquel explained that Docker, the company which made containers hotter than hot, was switching its Docker Desktop development platform for Windows from full-scale Hyper-V to the ligher WSL2 Hyper-V virtual machine (VM).

Why? Ferquel wrote, with Microsoft "actually providing a real Linux Kernel running inside a lightweight VM... it's more lightweight and more tightly integrated with Windows than Docker can provide alone. The Docker daemon runs well on it with great performance."

How efficient is it? Ferquel claims booting up WSL2 and the Docker daemon after a cold start is "blazingly fast -- within 2s on our development laptops, compared to tens of seconds in the current version of Docker Desktop."

Can you say fast? Docker can.

The decision to switch to WSL2 wasn't made quickly though. Docker worked with early WSL2 builds. Docker protyped different approaches. Now, the new faster Docker Desktop is on its way to developers.

Docker will replace the Hyper-V VM with a WSL2 integration package. It will come with the same features as the current Docker Desktop. This includes Kubernetes 1-click setup, automatic updates, transparent HTTP proxy configuration, access to the daemon from Windows, transparent bind mounts of Windows files, and more.

What will really make Docker developers happy is they'll be able to develop both Windows and Linux containerized programs simultaneously. Ferquel claimed this will have a "huge impact for developers working on projects targeting a Linux environment, or with a build process tailored for Linux. No need for maintaining both Linux and Windows build scripts anymore! As an example, a developer at Docker can now work on the Linux Docker daemon on Windows, using the same set of tools and scripts as a developer on a Linux machine."

He also claims bind mounts from WSL will have nearly identical I/O performance as on a native Linux machine. This will solve one of the major Docker Desktop pain points with I/O-heavy toolchains. NodeJS, PHP and other web development tools will benefit from this improvement.

Performance isn't the older Docker Desktop's only problem. Windows file bind mounts have been, shall we say, less than reliable. "The current implementation relies on Samba Windows service, which may be deactivated, blocked by enterprise GPOs, blocked by 3rd party firewalls, etc. Docker Desktop with WSL 2 will take a new approach of implementing bind mounts of Windows files, which Docker promises, "will provide an "it just works" experience, out of the box."

In addition, "combined with Visual Studio Code "Remote to WSL", Docker Desktop Linux workspaces will make it possible to run a full Linux toolchain for building containers on your local machine, from your IDE running on Windows."

Where is all this speed coming from?

First, WSL2 runs on a native Linux 4.19 kernel to Windows. The first WS has to translate Linux syscalls into their corresponding Windows APIs. WSL2 instead runs Linux in a lightweight Hyper-V VM so no time is lost in syscall translations.

Another major performance boost comes with the Linux filesystem now also using the Linux EXT4 file system. Before it had to translate file I/O calls to Windows's NTFS. To bridge the file systems, Microsoft is using a blast from the past: The Plan 9 File System Protocol (9P). The 9P network file system server lets each operating system work smoothly with each other file system.

The net result of this transformation is you should get both Linux and Windows native filesystem I/O performance.

It's early days still. The Docker Desktop for WSL2 technical preview isn't even out yet. It will be available for download in July. Docker promises it will run side by side with the current version of Docker Desktop, so you can continue to work safely on your existing projects.

Still, if the new Docker Desktop lives up to its promise, it will become the Windows Docker development platform for both Windows Server and Linux servers and all the cloud platforms built on them,

Related Stories: