Almost every modern project is unthinkable without the use of docker. It allows you to make the development environment unified for all developers. Despite the fact that docker can be installed on the Windows OS without any problems, the performance of such projects is still at a rather low level. I will talk about my successful experience of deploying projects on Windows OS and the problems I encountered. However, if you have something to add or correct, please write to me.
After several failures, I decided to deploy the project not directly on Windows, but on WSL2, and I will explain why later. When I started to get acquainted with WSL, I had Windows 10 OS installed. And there is a certain nuance here. Depending on the build, it can have either the first or second version of WSL. The second version can be installed (turned on) on Windows 10 only if the build number is 18362 or higher. To check the build number, you need to go to Start - settings - System - About system - OS build. So I updated my Windows 10 to the latest build and installed the project on WSL2, but I was disappointed - I didn't get a significant performance boost for the project. That's why I decided to upgrade to Windows 11. So all my following recommendations apply to Windows 11.
By default, WSL2 is disabled. To enable it:
Start - Turn Windows tools on or off
In the window that pops up, check the following items: Virtual Machine Platform and Windows Support for Linux.
Wait for installation and restart your computer.

Next, you need to download and install the Ubuntu emulator from the Microsoft store. At this step, it is very important that you download this particular version. The Microsoft store has other versions of Ubuntu, but I had difficulties with some of them.
I had 2 versions of WSL installed on my Windows 10, but Windows 11 usually only has the second version, but just to be sure, I advise you to take some precautions.
Set WSL2 as default. Open cmdwsl --set-default-version 2
Installing the WSL2 version for the newly installed Ubuntuwsl --set-version Ubuntu 2
You can use just docker itself, but I use Docker Desktop, which includes many additional tools. Its main advantage is its excellent interface, but Docker Desktop is paid for commercial use. That is, you can do some personal non-commercial projects on it, but if you use it as an employee of a commercial company, you need to buy a license.
After installation, I recommend checking the WSL2 settings. Go to the console and enter the wsl -l -v commandC:\Users\Dmytro>wsl -l -vNAME STATE VERSION* Ubuntu Running 2docker-desktop-data Running 2docker-desktop Running 2
Now we need to integrate Docker Desktop and the installed Ubuntu emulator. Go to Docker Desktop. In the upper right corner there is a gear symbol (settings). Click on it. In the General tab, check the box “Use the WSL 2 based engine”

Next, go to the tab Resources - WSL integration. Tick “Enable integration with my default WSL distro” and enable the switch next to Ubuntu.

Next, press the "Apply & restart" button. Docker will restart and you are good to go.
If you did everything correctly, you should have 3 new folders in "My Computer":
- docker-desktop
- docker-desktop-data
- Ubuntu

The first two folders are used by docker for its own needs, and the last one is what we need to work with.
At the beginning of the article, I said that I did not deploy the project directly in Windows, but in WSL. All the actions listed above were in order to be able to lean the project into the Linux file system. When I was experimenting with docker, I was trying to clone a project from GitHub into one of my Windows folders. Cloning is successful, because git works stably on different OSes. The drop in performance occurs when mounting the Windows folder and the corresponding folder in the middle of the docker container, because the files in them have at least different line endings.
Therefore, it is important to clone the project in the newly created "Ubuntu" folder. For the test, you can clone and run this site locally. To do this, we need to get into a virtual machine. There are several options:
Start - enter Ubuntu in the search. Click on the Ubuntu icon
Start - cmd. In the console, write wsl
The root folder you'll end up in will correspond to the Ubuntu folder that you open through File Explorer. So let's test:mkdir projectscd projectsmkdir testcd testsudo apt-get updatesudo apt-get install git dockergit clone https://github.com/hevyweb/mySite.git .docker-desktop up
On first run, docker will compile and run the project. Watch the installation log output. Errors are possible.