Table of contents
1.3 Difference between Docker and virtual machine
2. Docker installation (Windows version)
1. Introduction
1.1 How does Docker solve the compatibility problems of complex dependencies of large projects and dependencies of different components?
- Docker allows applications, dependencies, function libraries, and configurations to be packaged together during development to form a portable image
- Docker applications run in containers and use the sandbox mechanism to isolate them from each other
1.2 How does Docker solve the problem of differences in development, testing, and production environments
- The Docker image contains a complete operating environment, including the system function library, and only depends on the Linux kernel of the system, so it can run on any Linux operating system
1.3 Difference between Docker and virtual machine
Docker implements running and deployment on different linux operating systems
- docker is a system process; a virtual machine is an operating system within an operating system
- docker is small in size, fast in startup speed and good in performance; the virtual machine is large in size, slow in startup speed and average in performance
1.4 Docker architecture
Image (Image): Docker packages the application and its required dependencies, function library, environment, configuration and other files together into a mirror (that is, a file in the hard disk)
Container (Container): The process formed after the application in the mirror is running is a container, but Docker will isolate the container and make it invisible to the outside world
Containers can read data from the image, but cannot write
How will the MYSQL container write data in the future?
Copy the data to your own independent file system, and write it to your own place when writing data (the log is also the same principle, the mirror will not be disturbed and affected)
DockerHub: DockerHub is a hosting platform for Docker images, such a platform is called Docker Registry
Docker is a program of CS architecture, which consists of two parts
- Server (server): Docker daemon process, responsible for processing Docker instructions, managing images, containers, etc.
- Client (client): Send instructions to the Docker server through commands or RestAPI. Commands can be sent to the server locally or remotely
1.5 Summary
Docker is a technology for quickly delivering applications and running applications:
- The program, its dependencies, and the operating environment can be packaged together into a mirror image, which can be migrated to any Linux operating system
- The sandbox mechanism is used to form an isolated container during runtime, and each application does not interfere with each other
- Both startup and removal can be completed with one line of commands, which is convenient and quick
2. Docker installation (Windows version)
2.1 Prepare the environment
As for why I use the Windows version, I think it is too troublesome to use a virtual machine, and downloading a virtual machine to install various systems takes up a lot of space. What’s more, it’s annoying that my virtual machine can’t be installed at all. I don’t have a good impression of him.
Conditions: 1. Must be running Windows 10 version 2004 and above or Windows 11
2. Turn on virtualization at the position shown in the picture below, it is usually turned on, it is best to take a look, just in case
Start the command window as an administrator, enter: wsl --install
The download may be very slow, wait patiently, try not to let him terminate halfway (keep the network good), if you haven’t moved for a long time, you can press Enter a few times to try
The installation is complete
Remember to restart your computer! ! !
Once again, the administrator opens the command window and enters the following command
wsl --install -d Ubuntu
It may be a bit slow, if there is no response for a long time, press Enter
Enter the user name and password (I had a little accident when I entered the user name and password here)
Username: zhangjingqi
Password: 123456 (it will not be displayed when entering the password, just grasp it by yourself)
2.2 Docker installation
URL:
https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe
After the download is complete, double-click to run
The picture below means to add a desktop shortcut, you can add it or not, depending on your personal preference, and then click OK
The following prompts that the installation is successful, restart the computer, and click the blue one.
forced to accept terms
The following interface appears to indicate that the installation is successful
2.3 Modify the image
{
"registry-mirrors" : [
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://cr.console.aliyun.com",
"https://mirror.ccs.tencentyun.com"
],
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"features": {
"buildkit": true
}
}
Turn around all the time, wait for a while, and stop turning
3. Install portanier (visualized Docker operation page)
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ee:latest
The picture below shows that the installation is complete, and this step is enough
Enter localhost:9433 in the URL, come out of the following page and click Advanced to continue to visit
After this happens