Explanation:
Containers are lightweight and portable executable units (images) of software. They supply portability between different platforms and clouds. Containers are self-contained units that are designed to hold applications as well as all libraries and dependencies that the application requires. Containers can be run on physical computers or in the cloud.
Containers do not have an operating system of their own. Instead, they access the operating system of the device they are running on using a hypervisor. This allows them to be more light-weight, easier to provision, and much smaller than traditional virtual machines.
Virtual machine is a virtual re-presentation of physical computer, you can understand it as a computer inside a computer. Each individual virtual machine behaves exactly as though it were its own computer. It has its own operating system, memory, storage, and compute and is totally unaware of other virtual machines that could be running on the same host.
How do containers differ from a traditional VM?
Traditional virtualization leverages a hypervisor to virtualize physical hardware. Each VM contains:
- A guest operating system (OS)
- A virtual copy of the hardware that the OS requires to run
- An application and its associated libraries and dependencies
- Containers, on the other hand, virtualize the operating system. Each container only contains:
- The application
- Its libraries
- Its dependencies