2019-08-11 18:49:23 +08:00
# # Why use Docker ?
2020-10-22 14:09:10 +08:00
As a new virtualization technology , Docker has many advantages over
2019-08-11 18:49:23 +08:00
other traditional virtualization solutions .
2020-10-22 14:09:10 +08:00
# # # Use System Resources more Efficiently
2019-08-11 18:49:23 +08:00
2020-10-22 14:09:10 +08:00
Docker has high utilization rate of system resources , because container does not need additional overhead such as hardware virtualization or running the whole system . It ' s more efficient than traditional virtual machine technology in terms of execution speed , memory expense and file storage speed . Therefore , a host with the same configuration can often run more applications than virtual machine technology .
2019-08-11 18:49:23 +08:00
2020-10-22 14:09:10 +08:00
# # # Faster Startup Time
2019-08-11 18:49:23 +08:00
2020-10-22 14:09:10 +08:00
The traditional virtual machine technology needs minutes to startup application service , but Docker can do it in seconds or milliseconds due to running on the kernel of host machine and not running the whole system . It saves a considerable amount of time for development , testing and deployment .
2019-08-11 18:49:23 +08:00
2020-10-22 14:09:10 +08:00
# # # Consistent Operating Environment
2019-08-11 18:49:23 +08:00
2020-10-22 14:09:10 +08:00
Environment setup consistency is a common problem in DevOps . Inconsistent configuration can cause some bugs not found at development time but revealed at production due to the subtle differences between the development , testing and production environments . The docker image can provide a complete runtime environment without kernel , which ensures consistency of the application environment throughout its lifecycle , eliminating issues like * This piece of code is okey on my machine * .
2019-08-11 18:49:23 +08:00
# # # CI / CD
2020-10-22 14:09:10 +08:00
For development and operation ( [ DevOps ] ( https : //zh.wikipedia.org/wiki/DevOps)) engineers, the desirable thing is to create and configure once to run anywhere.
2019-08-11 18:49:23 +08:00
2020-10-22 14:09:10 +08:00
CI / CD can be achieved by customizing application mirrors with Docker . Developers can build images with [ Dockerfile ] ( . . / image / dockerfile / ) and use [ Continuous Integration ] ( https : //en.wikipedia.org/wiki/Continuous_integration) for integration testing. Operation teams can deploy production environments quickly with the images, and even make automatic deployments possible by using [Continuous Delivery/Deployment](https://en.wikipedia.org/wiki/Continuous_delivery) techniques.
2019-08-11 18:49:23 +08:00
2020-10-22 14:09:10 +08:00
And ` Dockerfile ` makes mirror construction transparent . Not only does the development team understand the application runtime environment , but it also facilitates the operation team to understand the requirements of the application and better deployment in production environments .
2014-09-25 17:23:05 +08:00
2019-08-30 14:50:51 +08:00
# # # Easier migration
2014-09-25 17:23:05 +08:00
2020-10-22 14:09:10 +08:00
Because Docker ensures consistency in the execution environment , application migration is easier . Docker can run on multiple platforms , including physical , virtual machines or public / private clouds , with consistent results . Therefore , users can easily migrate applications from one platform to another whitout worrying about the cross - platform difficulties .
2016-11-07 04:00:17 +08:00
2019-08-30 14:50:51 +08:00
# # # Easier maintenance and extension
2016-11-07 04:00:17 +08:00
2020-10-22 14:09:10 +08:00
Docker uses layered storage and mirror technology , so it is easier to reuse the repetitive parts of the application and simpler to expand the image based on the basic mirror . In addition , the Docker team maintains a lot of high - quality [ official images ] ( https : //hub.docker.com/search/?type=image&image_filter=official) together with various open-source project teams. It can be used directly in the production environment with customization, greatly reducing the cost of image production of various application services.
2014-10-03 11:34:57 +08:00
2019-08-30 14:50:51 +08:00
# # # Contrast traditional virtual machines
2016-08-04 14:41:40 +08:00
2019-08-30 14:50:51 +08:00
| Feature | Container | Virtual Machine |
| : -- -- -- -- | : -- -- -- -- | : -- -- -- -- -- |
| Boot | seconds | minutes |
| Disk Usage | MB | GB |
| Performance | close to native | weaker |
2020-10-22 14:09:10 +08:00
| System Support | thousands | dozens in general |