The difference between containers and virtual machines
For a container, it is a relatively independent runtime environment, somewhat similar to a virtual machine in this respect, but not as complete as a virtual machine. Inside the container, the impact on the outside world should be minimized. For example, you cannot consume all the resources on the host inside the container. This is called resource control.
The main differences between containers and virtual machines are the location of the virtualization layer and how the operating system resources are used.
Containers and virtual machines have a similar mission: to isolate applications and their associations to build a self-contained unit that can run anywhere. In addition, containers and virtual machines remove the need for physical hardware and allow us to use computing resources more efficiently, thereby increasing energy efficiency and cost-effectiveness.
The virtual machine packs virtual hardware, the kernel (that is, the operating system), and user-space into a new virtual machine that can run on a physical device using a hypervisor. Virtual machines rely on hypervisors, which are often installed on "bare metal" system hardware, leading to hypervisors being considered operating systems in some ways. Once the hypervisor installation is complete, virtual machine instances can be allocated from the system's available computing resources, with each virtual machine receiving a unique operating system and load (application). In short, the virtual machine first needs to virtual a physical environment, then build a complete operating system, then build a layer of Runtime, and then supply the program to run. Such that, Vinchin backup & Recovery provided the backup solution for virtual machines.
For a container environment, you don't need to install the host operating system, just install the container layer (such as LXC or libContainer) on top of the host operating system (usually a Linux variant). After the container layer is installed, container instances can be allocated from the system's available computing resources, and enterprise applications can be deployed within the container. However, each containerized application shares the same operating system (a single host operating system). A container can be viewed as a virtual machine loaded with a specific set of applications. It directly leverages the host kernel, has fewer abstraction layers, is lighter, and starts up very quickly.
Containers are more resource-efficient than virtual machines because they don't need to assign a separate operating system to each application -- instances are smaller, faster to create, and migrate. This means that a single operating system can hold more containers than a virtual machine. Because containers do not package the kernel or virtual hardware the same way virtual machines do, each container has its own isolated userspace, allowing multiple containers to run on the same host system. We can see that all operating-system-level architectures can be Shared across containers; the only things that need to be built independently are binaries and libraries. Because of this, the container has excellent lightweight characteristics.