How does a container differ from a virtual machine?easy
Answer
Containers share the host OS kernel and isolate only the process and filesystem. VMs include a full OS and run on a hypervisor - heavier, slower to start, but stronger isolation.
Explanation
Containers start in milliseconds, use MB of memory overhead, and achieve near-native performance. VMs take seconds to minutes to boot, use GB of memory, and provide hardware-level isolation (stronger security, full OS independence). Containers use Linux namespaces (PID, network, mount) and cgroups (resource limits) for isolation. Use VMs when you need stronger security boundaries or a different OS; use containers for consistent, fast, lightweight application packaging.
Follow-upCan you run containers inside a VM?