Containers vs. Virtual Machines

Containers Virtual Machines
Representative Docker1 VirtualBox
Shared HW + OS2 HW
Daemon Engine Hypervisor
Persistence Image Image
Instance Container VM
Workflow
  1. Write Docker File
  2. Create Docker Image
  3. Run Container
  1. Get OS Image
  2. Create VM Image
  3. Run VM
Pros
  • Better performance
  • Lower resource consumption
  • OS diversity (for VMs)
  • Stronger isolation

1 Docker uses Linux for its Containers.
2 Docker uses cgroups (resource restriction) and namespaces (isolation).