Docker Desktop WSL 2 backend Japanese translation

Japanese translation of https://docs.docker.com/docker-for-windows/wsl/.

Windows Subsystem for Linux (WSL) 2 is a complete Linux kernel built by Microsoft. Major architectural changes have been made to allow Linux containers to run natively without emulation. Running Docker desktops on WSL 2 allows users to take advantage of the Linux workspace and eliminate the need to maintain both Linux and Windows build scripts. In addition, WSL 2 improves file system sharing and startup time, giving Docker desktop users access to cool new features.

Docker Desktop uses WSL 2's dynamic memory allocation feature to significantly improve resource consumption. This means that Docker desktops use only the required amount of CPU and memory resources, allowing you to perform tasks such as building CPU- and memory-intensive containers faster.

In addition, WSL 2 requires significantly faster time to start the Docker daemon after a cold start. It takes less than 10 seconds to start the Docker daemon, compared to almost a minute on previous versions of Docker desktops.

Prerequisites

Before you install the Docker Desktop WSL 2 backend, you need to complete the following steps:

Install Windows 10 version 2004 or later. The Docker Desktop Edge release also supports Windows 10, version 1903 and later. Enable the WSL 2 feature on Windows. See your Microsoft documentation for detailed instructions. Download and install the Linux kernel update package.

download

Download Docker Desktop Stable 2.3.0.2 or a later release.

Installation

Before installing the Docker Desktop Stable 2.3.0.2 release, make sure you have completed the steps described in the Prerequisites section.

Follow the normal installation procedure to install the Docker desktop. If you are running a supported system, Docker Desktop will prompt you to enable WSL 2 during installation. Read the information displayed on the screen, enable WSL 2 and continue. Launch the Docker desktop from the Windows Start menu.

Select Settings> General from the Docker menu.

Select the Use WSL 2-based engine `` check box.

This option is enabled by default if you installed the Docker desktop on a system that supports WSL 2.

Click Apply and Reboot.

Make sure the distribution runs in WSL 2 mode. WSL can run distributions in both v1 and v2 modes.

To check the WSL mode, run the following command:

wsl.exe -l -v

To upgrade your existing Linux distribution to v2, run the following command:

wsl.exe --set-version (distro name) 2

To set v2 as the default version for future installations, run the following command:

wsl.exe --set-default-version 2

After the Docker desktop restarts, go to Settings> [Resources]> [WSL Integration].

WSL integration is enabled on the default WSL distribution. To change the default WSL distribution, run wsl --set-default <distro name>.

For example, to set Ubuntu as the default WSL distribution, run wsl --set-default ubuntu.

Optionally select an additional distribution to enable WSL 2.

Click Apply and Reboot.

Develop with Docker and WSL 2

The next section describes how to get started developing your application with Docker and WSL 2. For the best development experience with Docker and WSL 2, we recommend that you put your code in the default Linux distribution. After enabling WSL 2 on DockerDesktop, you can start working with the code in your Linux distribution. Ideally you can use the IDE on Windows. If you're using VSCode, this workflow is pretty straightforward.

Open VSCode and install the Remote-WSL extension. This extension allows you to work with remote servers on Linux distributions and IDE clients on Windows.

You can now start working remotely with VSCode. To do the above, open a terminal and type:

wsl
code .

This will open a new VS Code that is remotely connected to your default Linux distribution. You can see this in the bottom corner of the screen.

You can also enter the name of the default Linux distribution in the Start menu to open it and run the code.

When you're in VSCode, you can use VSCode's terminal to pull your code and start working natively from your Windows machine.

best practice

To maximize file system performance when binding and mounting files:

Stores source code and other data that is bound and mounted in the Linux container of the Linux file system instead of the Windows file system. (Use docker run -v <host-path>: <container-path>) Linux containers receive file change events ( inotify events) only if the original file is stored on the Linux file system. Performance is significantly improved when files are bind-mounted from a Linux file system rather than from a Windows host. So avoid docker run -v / mnt / c / users: / users ( / mnt / c is mounted from Windows). Instead, use a command like docker run -v ~ / my-project: / sources <my-image> from the Linux shell. Here ~ is expanded to $ HOME by the Linux shell.

If you are concerned about the size of the docker-desktop-data VHDX or need to change it, take a look at the WSL tools built into Windows. If you are concerned about CPU or memory usage, you can set limits on the memory, CPU, and swap size allocated to the WSL 2 utility VM. To avoid potential conflicts with using WSL 2 with Docker desktops, you must uninstall previous versions of the Docker engine and CLI installed directly from your Linux distribution before installing Docker desktops. There is.

Recommended Posts

Docker Desktop WSL 2 backend Japanese translation
Docker Gradle Quick Reference Japanese Translation
Introducing Docker Desktop for Windows on WSL2
[Introduction to Docker] Official Tutorial (Japanese translation)
settings.gradle Japanese translation
Gradle Japanese translation
build.gradle Japanese translation
Comfortable development life with WSL2 + Docker Desktop + GPU
Official tutorial to learn Docker systematically Japanese translation
Operate Docker Desktop for Windows on Linux (WSL)
Java Quickstart Japanese translation
gradle tasks Japanese translation
Explode Docker with WSL2
Comfortable Docker environment created with WSL2 CentOS7 and Docker Desktop
Docker installation on WSL2
WSL2 + VSCode + Docker development environment
Japanese input on Ubuntu20.04 Desktop
Docker autostart settings with wsl2
Build docker environment with WSL
Build Go development environment with WSL2 + Docker Desktop + VSCode (Remote --Containers)
WSL2 + Docker Desktop for Windows does not launch only MySQL container