Estimated reading time: 8 minutes Show Windows Subsystem for Linux (WSL) 2 introduces a significant architectural change as it is a full Linux kernel built by Microsoft, allowing Linux distributions to run without having to manage Virtual Machines. With Docker Desktop running on WSL 2, users can leverage Linux workspaces and avoid having to maintain both Linux and Windows build scripts. In addition, WSL 2 provides improvements to file system sharing, boot time, and allows access to some cool new features for Docker Desktop users. Docker Desktop uses the dynamic memory allocation feature in WSL 2 to greatly improve the resource consumption. This means, Docker Desktop only uses the required amount of CPU and memory resources it needs, while enabling CPU and memory-intensive tasks such as building a container to run much faster. Additionally, with WSL 2, the time required to start a Docker daemon after a cold start is significantly faster. It takes less than 10 seconds to start the Docker daemon when compared to almost a minute in the previous version of Docker Desktop. PrerequisitesBefore you install the Docker Desktop WSL 2 backend, you must complete the following steps:
DownloadDownload Docker Desktop for Windows. InstallEnsure you have completed the steps described in the Prerequisites section before installing the Docker Desktop release.
That’s it! Now Enabling Docker support in WSL 2 distrosWSL 2 adds support for “Linux distros” to Windows, where each distro behaves like a VM except they all run on top of a single shared Linux kernel. Docker Desktop does not require any particular Linux distros to be installed. The
Best practices
Develop with Docker and WSL 2The following section describes how to start developing your applications using Docker and WSL 2. We recommend that you have your code in your default Linux distribution for the best development experience using Docker and WSL 2. After you have enabled WSL 2 on Docker Desktop, you can start working with your code inside the Linux distro and ideally with your IDE still in Windows. This workflow can be pretty straightforward if you are using VSCode.
GPU supportStarting with Docker Desktop 3.1.0, Docker Desktop supports WSL 2 GPU Paravirtualization (GPU-PV) on NVIDIA GPUs. To enable WSL 2 GPU Paravirtualization, you need:
To validate that everything works as expected, run the following command to run a short benchmark on your GPU:
FeedbackYour feedback is very important to us. Please let us know your feedback by creating an issue in the Docker Desktop for Windows GitHub repository and adding the WSL 2 label. WSL, WSL 2 Tech Preview, Windows Subsystem for Linux, WSL 2 backend DockerWhat specific technology must be supported if you are going to deploy a container in HyperVirtualized container hosts
Nested virtualization has the following requirements: At least 4 GB RAM available for the virtualized Hyper-V host. Windows Server 2022, Windows Server 2019, Windows Server 2016, or Windows 10 on the host system; and Windows Server (Nano Server or Server Core) on the virtual machine.
Does HyperWith Hyper-V isolation, multiple container instances run concurrently on a host; however, each container runs inside of a highly optimized virtual machine and effectively gets its own kernel. The presence of the virtual machine provides hardware-level isolation between each container as well as the container host.
What is a HyperHyper-V is an isolation mode for Windows containers featuring hardware-level isolation. This virtual isolation mode allows for multiple container instances to concurrently run in a secure manner on a single host.
Which of the following are supported Windows Container Isolation modes?For developers who are using Windows 10 Professional / Enterprise as their workhorse PC, and developing using Windows Docker Containers (NanoServer, ServerCore). There are two isolation modes that Windows Containers can run — Process (uses less hardware resource), HyperV (uses more hardware resource).
|