Docker related information
Docker official documentation: www.docker.com/get-started
Docker中文 reference manual: docker_practice.geitee. IO /zh-cn/
Docker official definition
-
We help indie developers and development teams build and release apps.
-
We offer you a complete container solution, no matter who you are, no matter where you are, you can start the container journey.
Conclusion: Docker is an application container technology.
Docker origin
Docker is an internal project initiated by dotCloud founder Solomon Hlykes while he was in France. It is based on dotCloud’s innovation of cloud service technology for many years, and opened source under Apache 2.0 license in March 2013. The main project code is maintained on Github. The Docker project later joined the Linux Foundation and formed the Alliance for Advancing Open Containers (OCI).
Docker’s Github project has more than 57,000 stars and more than 10,000 forks. DotCloud even decided to change its name to Docker at the end of 2013 due to the popularity of the Docker project. Docker was originally developed and implemented on Ubuntu 12.04. Red Hat has supported Docker since RHEL 6.5. Google has also widely used Docker in its PaaS products.
Docker uses Go language launched by Google for development and implementation, and is based on cgroup, Namespace of Linux kernel and Union FS of OverlayFS class to encapsulate and isolate processes, which is a virtualization technology at the level of operating system. An isolated process is also called an inner container because it is independent of the host and other isolated processes.
Operating system virtualization: Running a Docker container is equivalent to installing an operating system.
Docker advantage
1. Consistent environment
Consistent operating environment for easier migration.
Scenario: At development time, it works in the native test environment, but not in production.
Here we take a Java Web application as an example. A Java Web application involves many things, such as JDK, Tomcat, MySQL, and other software environments. When versions of one of these items are inconsistent across different environments, the application may not work. Docker packages the program and the environment used by the software directly together, ensuring that the environment is consistent regardless of the machine.
2. Environmental isolation
Processes are encapsulated and isolated, so that containers do not affect each other, which makes more efficient use of system resources.
Scenario: the server’s own program hung, the results found that someone else’s program out of trouble to eat up the memory, their program because the memory is not enough to hang.
This is also a common situation, if your application is not particularly important, it is almost impossible for the company to give your application a server. Your server will be sharing the same server with other programs in the company, so it will inevitably be interfered with by other programs and cause problems in your own programs. Docker is a good solution to the problem of environment isolation, other programs do not affect their own programs.
3. Mirror replication
Mirror N Multiple containers with the same environment.
Scenario: The company is going to host an event, there may be a lot of traffic coming in, and the company needs to deploy dozens more servers.
In the absence of Docker, dozens of servers need to be deployed within a few days, which is a very painful thing for operation and maintenance. Moreover, the environment of each server is not necessarily the same, so various problems will occur, and finally the deployment will be numb. With Docker, I just need to package the application to the image, and I will run as many containers as you need, greatly improving the deployment efficiency.
Image: The file Docker packages the application and environment together.
The difference between Docker and virtual machine
Disadvantages of VMS:
-
As shown in the figure, the virtual machine carries the operating system, and the small application becomes very large and cumbersome because of the operating system.
-
There are many steps in resource scheduling through virtual machines, especially when the virtual machine calls resources such as CPU, disk, and memory of the host machine. Take memory as an example. Virtual machines use hypervisors to virtualize memory. The entire process is virtual memory > virtual physical memory > real physical memory.
Docker advantage:
- Docker does not carry an operating system, so the application of Docker is very lightweight.
- Docker is the use of Docker Engine (Docker Engine) to call the host resources, the call process is virtual memory — > real physical memory.
Traditional VMS | Docker container | |
---|---|---|
Disk usage | From a few gigabytes to dozens of gigabytes | From tens of MB to hundreds of MB |
CPU Memory usage | Virtual operating systems are CPU and memory hogs | Docker engine usage is extremely low |
startup | A few minutes from startup to running the project | A few seconds from startup to running the project |
Installation management | Special operation and maintenance skills are required | Easy to install and manage |
Application deployment | Each deployment takes time and effort | Starting with the second deployment is easy and straightforward |
coupling | When multiple application services are installed together, they easily affect each other | Each application serves one container, forming isolation |
Since the system | There is no | If you need the same or similar kernel, Linux is recommended |