Which of the following best explains the main difference between a virtual machine (VM) and a container?
Think about what is virtualized in each technology: hardware or operating system.
Virtual machines virtualize hardware and run separate OS instances, while containers share the host OS kernel but isolate applications in separate user spaces.
Consider this simplified flowchart of starting a container:
- Host OS starts container runtime
- Runtime creates container namespace
- Container process starts using host kernel
- Application runs inside container
Which step ensures the container's file system and network are isolated from the host?
Namespaces isolate resources like file systems and networks.
Creating container namespaces isolates the container's file system, network, and process IDs from the host, providing separation.
Which statement correctly compares resource usage between virtual machines and containers?
Think about what each technology needs to load to start running.
Containers share the host OS kernel, so they use less memory and start quickly. VMs boot a full OS, which takes more resources and time.
Which technology uses cgroups and namespaces to isolate applications without running a full guest OS?
It isolates applications but shares the host OS kernel.
Containers use Linux cgroups and namespaces to isolate resources and processes without a full guest OS.
You need to run multiple different operating systems on one physical server for testing. Which approach is best and why?
Consider if the OSes need different kernels or full OS environments.
Virtual machines provide full hardware virtualization, allowing different OSes to run independently. Containers share the host OS kernel and cannot run different OS kernels.