Skip to content

Commit 44f49c3

Browse files
authored
wsl refresh (#24349)
<!--Delete sections as needed --> ## Description refreshes whilst I was in that space ## Related issues or tickets <!-- Related issues, pull requests, or Jira tickets --> ## Reviews <!-- Notes for reviewers here --> <!-- List applicable reviews (optionally @tag reviewers) --> - [ ] Technical review - [ ] Editorial review - [ ] Product review
1 parent e7e28c4 commit 44f49c3

1 file changed

Lines changed: 18 additions & 32 deletions

File tree

  • content/manuals/desktop/features/wsl

content/manuals/desktop/features/wsl/_index.md

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ aliases:
1313
- /desktop/wsl/
1414
---
1515

16-
Windows Subsystem for Linux (WSL) 2 is a full Linux kernel built by Microsoft, which lets Linux distributions run without managing virtual machines. With Docker Desktop running on WSL 2, users can leverage Linux workspaces and avoid maintaining both Linux and Windows build scripts. In addition, WSL 2 provides improvements to file system sharing and boot time.
16+
Windows Subsystem for Linux (WSL) 2 is a full Linux kernel built by Microsoft that lets Linux distributions run without managing virtual machines. With Docker Desktop running on WSL 2, users can leverage Linux workspaces and avoid maintaining both Linux and Windows build scripts. In addition, WSL 2 provides improvements to file system sharing, faster cold-start times, and dynamic resource allocation.
1717

18-
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.
19-
20-
Additionally, with WSL 2, the time required to start a Docker daemon after a cold start is significantly faster.
18+
Because WSL 2 uses dynamic memory allocation, Docker Desktop requests only the CPU and memory it actually needs — freeing resources for the rest of your system, while still letting memory-intensive tasks such as multi-stage image builds run at full speed.
2119

2220
## Prerequisites
2321

@@ -29,40 +27,34 @@ Before you turn on the Docker Desktop WSL 2 feature, ensure you have:
2927

3028
> [!TIP]
3129
>
32-
> For a better experience on WSL, consider enabling the WSL
33-
> [autoMemoryReclaim](https://learn.microsoft.com/en-us/windows/wsl/wsl-config#experimental-settings)
34-
> setting available since WSL 1.3.10 (experimental).
35-
>
36-
> 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.
30+
> Consider enabling the WSL [autoMemoryReclaim](https://learn.microsoft.com/en-us/windows/wsl/wsl-config#experimental-settings) setting, available since WSL 1.3.10 (experimental).
31+
>This setting allows Windows to reclaim unused memory from the WSL virtual machine, preventing the Linux kernel's page cache from holding onto large amounts of RAM after container image builds complete. The result is better memory availability for other applications on the host.
3732
3833
## Turn on Docker Desktop WSL 2
3934

40-
> [!IMPORTANT]
41-
>
42-
> To avoid any potential conflicts with using WSL 2 on Docker Desktop, you must uninstall any previous versions of Docker Engine and CLI installed directly through Linux distributions before installing Docker Desktop.
35+
Before installing Docker Desktop, uninstall any version of Docker Engine or the Docker CLI
36+
that was installed directly inside a WSL Linux distribution. Running both can cause conflicts.
4337

4438
1. Download and install the latest version of [Docker Desktop for Windows](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-windows).
4539
2. Follow the usual installation instructions to install Docker Desktop. Depending on which version of Windows you are using, Docker Desktop may prompt you to turn on WSL 2 during installation. Read the information displayed on the screen and turn on the WSL 2 feature to continue.
4640
3. Start Docker Desktop from the **Windows Start** menu.
4741
4. Navigate to **Settings**.
48-
5. From the **General** tab, select **Use WSL 2 based engine**..
42+
5. From the **General** tab, select **Use WSL 2 based engine**.
4943

5044
If you have installed Docker Desktop on a system that supports WSL 2, this option is turned on by default.
5145
6. Select **Apply**.
5246

53-
Now `docker` commands work from Windows using the new WSL 2 engine.
47+
`docker` commands are now available from any Windows terminal using the WSL 2 engine.
5448

5549
> [!TIP]
5650
>
5751
> By default, Docker Desktop stores the data for the WSL 2 engine at `C:\Users\[USERNAME]\AppData\Local\Docker\wsl`.
58-
> If you want to change the location, for example, to another drive you can do so via the `Settings -> Resources -> Advanced` page from the Docker Dashboard.
52+
> If you want to change the location, go to `Settings -> Resources -> Advanced` page from the Docker Dashboard.
5953
> Read more about this and other Windows settings at [Changing settings](/manuals/desktop/settings-and-maintenance/settings.md)
6054
61-
## Enabling Docker support in WSL 2 distributions
55+
## Enable Docker in a WSL 2 distribution
6256

63-
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.
64-
65-
Docker Desktop does not require any particular Linux distributions to be installed. The `docker` 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:
57+
WSL 2 lets multiple Linux distributions run side-by-side on a single shared kernel. Docker Desktop doesn't require a particular distribution to be installed, and `docker` commands work from Windows without one. However, enabling WSL integration for a distribution gives you direct access to `docker` commands from that distribution's terminal — which is useful for Linux-native development workflows.
6658

6759
1. Ensure the distribution runs in WSL 2 mode. WSL can run distributions in both v1 or v2 mode.
6860

@@ -94,24 +86,18 @@ Docker Desktop does not require any particular Linux distributions to be install
9486

9587
3. Select **Apply**.
9688

97-
> [!NOTE]
98-
>
99-
> With Docker Desktop version 4.30 and earlier, Docker Desktop installed two special-purpose internal Linux distributions `docker-desktop` and `docker-desktop-data`. `docker-desktop` is used to run the Docker engine `dockerd`, while `docker-desktop-data` stores containers and images. Neither can be used for general development.
100-
>
101-
> With fresh installations of Docker Desktop 4.30 and later, `docker-desktop-data` is no longer created. Instead, Docker Desktop creates and
102-
> manages its own virtual hard disk for storage. The `docker-desktop` distribution is still created and used to run the Docker engine.
103-
>
104-
> 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.
105-
10689
## WSL 2 security in Docker Desktop
10790

108-
Docker Desktop’s WSL 2 integration operates within the existing security model of WSL and does not introduce additional security risks beyond standard WSL behavior.
91+
Docker Desktop's WSL 2 integration works within WSL's existing security model and does not introduce security risks beyond standard WSL behavior.
92+
93+
Docker Desktop runs inside its own `docker-desktop` WSL distribution, isolated from other distributions in the same way any two WSL distributions are isolated from each other. Interaction between Docker Desktop and other distributions only occurs when you explicitly enable WSL integration for those distributions. This feature allows easy access to the Docker CLI from integrated distributions.
10994

110-
Docker Desktop runs within its own dedicated WSL distribution, `docker-desktop`, which follows the same isolation properties as any other WSL distribution. The only interaction between Docker Desktop and other installed WSL distributions occurs when the Docker Desktop **WSL integration** feature is enabled in settings. This feature allows easy access to the Docker CLI from integrated distributions.
95+
WSL is designed to aid interoperability between Windows and Linux environments. Its file system is accessible from the Windows host `\\wsl$`, meaning Windows processes can read and modify files within WSL. This behavior is not specific to Docker Desktop, but rather a core aspect of WSL itself.
11196

112-
WSL is designed to facilitate interoperability between Windows and Linux environments. Its file system is accessible from the Windows host `\\wsl$`, meaning Windows processes can read and modify files within WSL. This behavior is not specific to Docker Desktop, but rather a core aspect of WSL itself.
97+
For environments that require stricter isolation:
11398

114-
For organizations concerned about security risks related to WSL and want stricter isolation and security controls, run Docker Desktop in Hyper-V mode instead of WSL 2. Alternatively, run your container workloads with [Enhanced Container Isolation](/manuals/enterprise/security/hardened-desktop/enhanced-container-isolation/_index.md) enabled.
99+
- Run Docker Desktop in Hyper-V mode instead of WSL 2 to avoid the shared-kernel model entirely.
100+
- Enable [Enhanced Container Isolation](/manuals/enterprise/security/hardened-desktop/enhanced-container-isolation/_index.md) to add an additional layer of protection around container workloads regardless of backend.
115101

116102
## Additional resources
117103

0 commit comments

Comments
 (0)