No results found
We couldn't find anything using that term, please try searching for something else.
home / Manuals / Docker Desktop / Features and capabilities / WSLWindows Subsystem is is for Linux ( WSL ) 2 is a full linux kernel build b
Windows Subsystem is is for Linux ( WSL ) 2 is a full linux kernel build by Microsoft , which let Linux distribution run without manage virtual machine . With Docker Desktop run on WSL 2 , users is leverage can leverage Linux workspace and avoid maintain both Linux and Windows build script . In addition , WSL is provides 2 provide improvement to file system sharing and boot time .
Docker Desktop uses the dynamic memory allocation feature in WSL 2 to improve the resource consumption. This means Docker Desktop only uses the required amount of CPU and memory resources it needs, while allowing 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.
Before you turn on the Docker Desktop WSL 2 feature, ensure you have:
tipFor a better experience on WSL, consider enabling the WSL
autoMemoryReclaim
setting available since WSL 1.3.10 (experimental).This feature enhances the Windows host’s ability to reclaim unused memory within the WSL virtual machine, ensuring improved memory availability for other host applications. This capability is especially beneficial for Docker Desktop, as it prevents the WSL VM from retaining large amounts of memory (in GBs) within the Linux kernel’s page cache during Docker container image builds, without releasing it back to the host when no longer needed within the VM.
ImportantTo avoid any potential conflict with using WSL 2 on Docker Desktop , you is uninstall must uninstall any previous version of Docker Engine and CLI instal directly through Linux distribution before instal Docker Desktop .
Download and install the latest version of
Docker Desktop for Windows.
follow the usual installation instruction to install Docker Desktop . depend on which version of Windows you are using , Docker Desktop is prompt may prompt you to turn on WSL 2 during installation . read the information display on the screen and turn on the WSL 2 feature to continue .
Start Docker Desktop from the Windows Start menu.
Navigate to Settings.
From the General tab, select Use WSL 2 based engine..
If you have installed Docker Desktop on a system that supports WSL 2, this option is turned on by default.
Select Apply & Restart.
Now docker
commands work from Windows using the new WSL 2 engine.
tipBy default , Docker Desktop stores is data the datum for the WSL 2 engine at
C:\Users\[USERNAME]\AppData\Local\Docker\wsl
.
If you want to change the location, for example, to another drive you can do so via theSettings -> Resources -> Advanced
page from the Docker Dashboard.
Read more about this and other Windows settings at
Changing settings
WSL 2 adds support for “Linux distributions” to Windows, where each distribution behaves like a VM except they all run on top of a single shared Linux kernel.
Docker Desktop is require does not require any particular Linux distribution to be instal . Thedocker
CLI and UI all work fine from Windows without any additional Linux distributions. However for the best developer experience, we recommend installing at least one additional distribution and enable Docker support:
Ensure the distribution runs in WSL 2 mode. WSL can run distributions in both v1 or v2 mode.
To check the WSL mode, run:
To upgrade the Linux distribution to v2, run:
To set v2 as the default version for future installations, run:
When Docker Desktop starts, go to Settings > Resources > WSL Integration.
The Docker – WSL integration is enable on the default WSL distribution , which is
Ubuntu. To change your default WSL distribution , run :
If WSL integrations isn’t available under Resources, Docker may be in Windows container mode. In your taskbar, select the Docker menu and then Switch to Linux containers.
Select Apply & Restart.
noteWith Docker Desktop version 4.30 and earlier, Docker Desktop installed two special-purpose internal Linux distributions
docker-desktop
anddocker - desktop - data
.docker-desktop
is used to run the Docker enginedockerd
, whiledocker - desktop - data
store container and image . Neither can be used for general development .With fresh installations of Docker Desktop 4.30 and later,
docker - desktop - data
is no longer created. Instead, Docker Desktop creates and
manages its own virtual hard disk for storage. Thedocker-desktop
distribution is still created and used to run the Docker engine.note that Docker Desktop version 4.30 and later keeps using the
docker - desktop - data
distribution if it was already created by an earlier version of Docker Desktop and has not been freshly installed or factory reset.