Home >Operation and Maintenance >Docker >The main difference between docker and virtual machines
The main difference between docker and virtual machines:
Docker is an open source application container engine that allows developers to package their applications and Dependencies are packaged into a portable container and then distributed to any popular Linux machine, which can also be virtualized. Containers completely use the sandbox mechanism and will not have any interfaces with each other.
Virtual machine (Virtual Machine) refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment.
The difference between virtual machines and containers
Startup time: Docker starts in seconds, and virtual machines start in minutes.
Lightweight: The docker image size is usually in M, and the virtual machine is in G. Containers occupy small resources and are faster to deploy than virtual machines.
Performance: Docker shares the host kernel, system-level virtualization, takes up less resources, has no Hypervisor layer overhead, and its performance is basically close to that of a physical machine; the virtual machine requires Hypervisor layer support, virtualizes some devices, and has a complete GuestOS , virtualization overhead is large, thus reducing performance and not as good as container performance.
Security: Since the host kernel is shared, it is only process-level isolation, so the isolation and stability are not as good as that of the virtual machine. Docker has certain permissions to access the host kernel, which poses certain security risks.
Usage requirements: VM is fully virtualized based on hardware and requires hardware CPU virtualization technology support; docker shares the host kernel and can run on mainstream Linux distributions, regardless of whether the CPU supports virtualization technology.
For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.
The above is the detailed content of The main difference between docker and virtual machines. For more information, please follow other related articles on the PHP Chinese website!