1.
Check the system requirements
WSL 2 backend
Windows 11 64-bit: Home or Pro version 21H2 or higher, or Enterprise or Education
version 21H2 or higher.
Windows 10 64-bit: Home or Pro 21H1 (build 19043) or higher, or Enterprise or
Education 20H2 (build 19042) or higher.
Enable the WSL 2 feature on Windows. For detailed instructions, refer to
the Microsoft documentation.
The following hardware prerequisites are required to successfully run WSL 2 on
Windows 10 or Windows 11:
64-bit processor with Second Level Address Translation (SLAT)
4GB system RAM
BIOS-level hardware virtualization support must be enabled in the BIOS
settings. For more information, see Virtualization.
Hyper-V backend and Windows containers
Windows 11 64-bit: Pro version 21H2 or higher, or Enterprise or Education version
21H2 or higher.
Windows 10 64-bit: Pro 21H1 (build 19043) or higher, or Enterprise or Education
20H2 (build 19042) or higher.
For Windows 10 and Windows 11 Home, see the system requirements in the WSL 2
backend tab.
Hyper-V and Containers Windows features must be enabled.
2. Virtualization
Your machine must have the following features for Docker Desktop to function correctly.
[Go to Turn windows features on and off ]
WSL 2 and Windows Home
1. Virtual Machine Platform
2. Windows Subsystem for Linux
3. Virtualization enabled in the BIOS
4. Hypervisor enabled at Windows startup
Hyper-V
On Windows 10 Pro or Enterprise, you can also use Hyper-V with the following features
enabled:
1. Hyper-V installed and working
2. Virtualization enabled in the BIOS
3. Hypervisor enabled at Windows startup
3. Check the Task Manager: Virtualization must be enabled
In addition to Hyper-V or WSL 2, virtualization must be enabled. Check the Performance tab
on the Task Manager:
If you manually uninstall Hyper-V, WSL 2 or disable virtualization, Docker Desktop cannot
start.
4. Install your Linux distribution
Open the Microsoft Store and select your favourite Linux distribution.
Download the latest version of Ubuntu. The first time you launch a newly installed Linux
distribution, a console window will open, and you'll be asked to wait for a minute or two for
files to de-compress and be stored on your PC. All future launches should take less than a
second.
You will then need to create a user account and password for your new Linux distribution.
5. Install docker and wsl
Download docker desktop and wsl in windows from the browser. Install the docker
desktop and wsl. Restart the system.
Do settings in Docker desktop like below:
Upgrade version from WSL 1 to WSL 2 using Windows Powershell
New Linux installations, installed using the wsl --install command, will be set to WSL 2
by default.
The wsl --set-version command can be used to downgrade from WSL 2 to WSL 1 or to
update previously installed Linux distributions from WSL 1 to WSL 2.
To see whether your Linux distribution is set to WSL 1 or WSL 2, use the command: wsl -l
-v
To change versions, use the command: wsl --set-version <distro name>
2 replacing <distro name> with the name of the Linux distribution that you want to update.
For example, wsl --set-version Ubuntu-22.04 2 will set your Ubuntu 22.04 distribution
to use WSL 2.
Restart your machine to complete the WSL install and update to WSL 2.
Goto setting in Docker Desktop and check resources ->wsl integration (shown as given
below):
2 ways to open docker desktop directly otherwise it will show error.
Error: is coming like below:
You are not allowed to use Docker
You must be in the "docker-users" group
Solve by two method:
1. By the command in Windows PowerShell
2. By the Manually through Computer Management
By the command in Windows PowerShell
If your admin account is different to your user account, you must add the user to the docker-
users group:
net localgroup docker-users <user> /add
By the Manually through Computer Management
add user to a Group:
1. Open the Groups folder
2. Select the Group
3. Double-click on the group
4. Under the Members box, To add a User
5. click the Add button and follow the process
Note: Use powershell as user if you started with admin do changes in computer
management .
User –(user name will be there)
Group- add user name to the group
(picture given below)
Restart your machine.
It should appear in this way after Ubuntu and docker desktop is updated.
write a command on wsl and Power shell to check it is working or not docker image