Docker Desktop WSL 2 backend
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.
Prerequisites
Before you install the Docker Desktop WSL 2 backend, you must complete the following steps:
- Install Windows 10, version 1903 or higher or Windows 11.
- Enable WSL 2 feature on Windows. For detailed instructions, refer to the Microsoft documentation.
- Download and install the Linux kernel update package.
Download
Download Docker Desktop for Windows.
Install
Ensure you have completed the steps described in the Prerequisites section before installing the Docker Desktop release.
- Follow the usual installation instructions to install Docker Desktop. If you are running a supported system, Docker Desktop prompts you to enable WSL 2 during installation. Read the information displayed on the screen and enable WSL 2 to continue.
- Start Docker Desktop from the Windows Start menu.
- From the Docker menu, select Settings > General.
- Select the
Use WSL 2 based engine
check box.
If you have installed Docker Desktop on a system that supports WSL 2, this option will be enabled by default. - Click Apply & Restart.
That’s it! Now docker
commands will work from Windows using the new WSL 2 engine.
转载请注明出处:Docker Desktop WSL 2 backend
原文地址:https://www.xiaotanzhu.com/docker/2022-06-11-docker-install-on-windows-wsl.html