One . Preface
1.1Docker What is it? ?
Docker It's an application package 、 distribution 、 Deployed tools . It is basically a lightweight virtual machine . There are only things we need in the virtual machine , Other superfluous things are necessary . Let's look at the picture below , Take a look at the comparison between it and a normal virtual machine : as follows :
1.2 pack 、 distribution 、 Deployment concept understanding
pack : The compilation environment required for software development , rely on , Third party libraries , Pack them together , Make a bag . distribution : You can put “” package ” Upload image warehouse , Others can easily access and install , Improved efficiency . Deploy : No matter what operating system , As long as there is “ package ”, You can run it with a simple command , Automatically simulate the same environment , Very convenient .
1.3 advantage / solve the problem
Think of a thing , Before, when I was taking on outsourcing projects , Because it's taking over other people's projects , Because of the environment , It took more than ten days to run successfully , And after the development , Redeployment to the server is also a very serious problem , So that it can't be solved now bug. It's a headache, isn't it , If we adopt Docker Development and deployment . This problem doesn't exist .
advantage : It ensures that the running environment on different machines is consistent , Will not appear on my machine, running normally , You have problems when the machine runs .
Important concepts : Mirror image 、 Containers
Mirror image : Similar to software installation package , It can be quickly spread and installed . Containers : Status after software installation , Each software running environment is independent 、 Segregated , It's called a container .
Two . install Docker
2.1 install
We click on the link below , Enter the official , Download and install :
Choose the appropriate version of the direct computer to install ->
Here is the installed desktop version . When the download is complete , Open the installation :
Once installed , One thing to note : You need to restart your computer after installation , Remember to save the file , I forgot to save and was forced to restart .
2.2 Error reporting solution :
If you encounter the following errors , Please go to my home page to search for keywords to read this article to solve the problem : The first mistake :
WSL 2 installation is incomplete.
The second mistake :
System.InvalidOperationException: Failed to set version to docker-desktop: exit code: -1
Search for keywords on my home page to read this article :
Click in to read , The above two errors can be solved .
3、 ... and , Set domestic image source
3.1 Domestic image source address
<table> <thead> <tr> <th> Image accelerator </th> <th> Mirror accelerator address </th> </tr> </thead> <tbody> <tr> <td>Docker The official image of China </td> <td>https://registry.docker-cn.com</td> </tr> <tr> <td>DaoCloud Mirror station </td> <td>http://f1361db2.m.daocloud.io</td> </tr> <tr> <td>Azure China mirror </td> <td>https://dockerhub.azk8s.cn</td> </tr> <tr> <td> Mirror station of HKUST </td> <td>https://docker.mirrors.ustc.edu.cn</td> </tr> <tr> <td> Alibaba cloud </td> <td>https://<your_code>.mirror.aliyuncs.com</td> </tr> <tr> <td> Qiniuyun </td> <td>https://reg-mirror.qiniu.com</td> </tr> <tr> <td> Netease cloud </td> <td>https://hub-mirror.c.163.com</td> </tr> <tr> <td> Tencent cloud </td> <td>https://mirror.ccs.tencentyun.com</td> </tr> </tbody> </table>
3.2 Image acceleration configuration mode
After solving the above BUG after , We successfully opened Docker( Here's the picture ), We click settings :
Replace the following code block with the box above .
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"features": {
"buildkit": true
},
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn/",
"https://1rlt72n0.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://reg-mirror.qiniu.com",
"https://dockerhub.azk8s.cn",
"https://mirror.ccs.tencentyun.com"
]
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
Click here to restart the application .
Four , ending
Here we are. , our Docker The deployment installation has been completed , In the next section we will record , How to use Docker Quick installation of software !
版权声明
本文为[51CTO]所创,转载请带上原文链接,感谢
https://cdmana.com/2022/174/202206231833089303.html