We know that the installation of docker is generally installed on the linux system, but if your host machine is windows, then you still want to install docker, then you need to install a virtual machine on your windows, and install a linux operating system on the virtual machine. Then install docker on the Linux operating system, which is more troublesome.
The emergence of docker desktop can solve the above problem. You only need to enable the virtualization function on windows, and then install docker desktop.
The first step is to start the virtualization function of hype-v.
Open Windows Settings - Applications - More Windows Features.
You can see that I don't have hype-v, so I need to add it.
The specific adding steps are as follows:
Create a .bat file locally with the content:
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
Save it as a .bat file, then right click and run as administrator.
After waiting for the installation, click Y in the last step. finish installation.
Then run powershell as an administrator. This is actually an upgraded version of cmd. You should be familiar with cmd. It is a command line tool under windows, just like our linux command line, but windows uses more graphics. The interface is aimed at a wide range of user groups.
Back to the text, execute the following commands in the power shell:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
The command is to start WSL. WSL is some components of the Linux operating system kernel. In fact, although we install docker under windows, our docker still runs on Linux, which is why we need to use WSL.
After the above command is executed, execute the following statement:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
The above command is the function to start the virtual machine.
Restart the computer when finished.
You can see that there is:
2. Install and update to wsl2, download it first;
下载地址:
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
After the download is complete, install it.
After the installation is complete, set wsl2 as the default version.
wsl --set-default-version 2
Once complete, restart your computer.
3. Install the docker desktop installer. Download from the official website:
https://docs.docker.com/desktop/windows/install/
After the download is complete, click Install and continue to the next step. After completion, you can use it. as follows:
Attach a very good article written by others, learn it:
https://www.cnblogs.com/cfam/p/15423285.html
https://blog.csdn.net/zou_hailin226/article/details/121278799