Move wsl 2 best practices

Signed-off-by: Usha Mandya <usha.mandya@docker.com>
This commit is contained in:
Usha Mandya 2020-10-09 11:45:59 +01:00
parent 4ac8fc0dc8
commit cb912718f7
1 changed files with 15 additions and 17 deletions

View File

@ -22,6 +22,21 @@ Before you install the Docker Desktop WSL 2 backend, you must complete the follo
2. Enable WSL 2 feature on Windows. For detailed instructions, refer to the [Microsoft documentation](https://docs.microsoft.com/en-us/windows/wsl/install-win10).
3. Download and install the [Linux kernel update package](https://docs.microsoft.com/windows/wsl/wsl2-kernel).
## Best practices
- To get the best out of the file system performance when bind-mounting files, we recommend storing source code and other data that is bind-mounted into Linux containers (i.e., with `docker run -v <host-path>:<container-path>`) in the Linux filesystem, rather than the Windows filesystem.
- Linux containers only receive file change events ("inotify events") if the
original files are stored in the Linux filesystem. For example, some web development workflows rely on inotify events for automatic reloading when files have changed.
- Performance is much higher when files are bind-mounted from the Linux
filesystem, rather than remoted from the Windows host. Therefore avoid
`docker run -v /mnt/c/users:/users` (where `/mnt/c` is mounted from Windows).
- Instead, from a Linux shell use a command like `docker run -v ~/my-project:/sources <my-image>`
where `~` is expanded by the Linux shell to `$HOME`.
- If you have concerns about the size of the docker-desktop-data VHDX, or need to change it, take a look at the [WSL tooling built into Windows](https://docs.microsoft.com/en-us/windows/wsl/wsl2-ux-changes#understanding-wsl-2-uses-a-vhd-and-what-to-do-if-you-reach-its-max-size).
- If you have concerns about CPU or memory usage, you can configure limits on the memory, CPU, Swap size allocated to the [WSL 2 utility VM](https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig).
- To avoid any potential conflicts with using WSL 2 on Docker Desktop, you must [uninstall any previous versions of Docker Engine](https://docs.docker.com/install/linux/docker-ce/ubuntu/#uninstall-docker-engine---community) and CLI installed directly through Linux distributions before installing Docker Desktop.
## Download
Download [Docker Desktop Stable 2.3.0.2](https://hub.docker.com/editions/community/docker-ce-desktop-windows/) or a later release.
@ -82,23 +97,6 @@ The following section describes how to start developing your applications using
Alternatively, you can type the name of your default Linux distro in your Start menu, open it, and then run `code` .
3. When you are in VSCode, you can use the terminal in VSCode to pull your code and start working natively from your Windows machine.
## Best practices
- To get the best out of the file system performance when bind-mounting files:
- Store source code and other data that is bind-mounted into Linux containers
(i.e., with `docker run -v <host-path>:<container-path>`) in the Linux
filesystem, rather than the Windows filesystem.
- Linux containers only receive file change events ("inotify events") if the
original files are stored in the Linux filesystem.
- Performance is much higher when files are bind-mounted from the Linux
filesystem, rather than remoted from the Windows host. Therefore avoid
`docker run -v /mnt/c/users:/users` (where `/mnt/c` is mounted from Windows).
- Instead, from a Linux shell use a command like `docker run -v ~/my-project:/sources <my-image>`
where `~` is expanded by the Linux shell to `$HOME`.
- If you have concerns about the size of the docker-desktop-data VHDX, or need to change it, take a look at the [WSL tooling built into Windows](https://docs.microsoft.com/en-us/windows/wsl/wsl2-ux-changes#understanding-wsl-2-uses-a-vhd-and-what-to-do-if-you-reach-its-max-size).
- If you have concerns about CPU or memory usage, you can configure limits on the memory, CPU, Swap size allocated to the [WSL 2 utility VM](https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig).
- To avoid any potential conflicts with using WSL 2 on Docker Desktop, you must [uninstall any previous versions of Docker Engine](https://docs.docker.com/install/linux/docker-ce/ubuntu/#uninstall-docker-engine---community) and CLI installed directly through Linux distributions before installing Docker Desktop.
## Feedback
Your feedback is very important to us. Please let us know your feedback by creating an issue in the [Docker Desktop for Windows GitHub](https://github.com/docker/for-win/issues) repository and adding the **WSL 2** label.