Skip to content

Instantly share code, notes, and snippets.

@satyajitnayk
Created December 22, 2023 12:27
Show Gist options
  • Save satyajitnayk/66761943d7ccb45898e765928cc96e77 to your computer and use it in GitHub Desktop.
Save satyajitnayk/66761943d7ccb45898e765928cc96e77 to your computer and use it in GitHub Desktop.
Docker vs Virtual Machines (VMs)

Docker vs Virtual Machines (VMs)

Introduction

  • Overview of Docker and Virtual Machines (VMs).
  • Agenda: Definitions, how they function, and guidance on workload suitability.

Common Themes

  • Both Docker and VMs address the concept of virtualization.

Virtualization

  • Virtualization: Using software to create an abstraction layer.
  • VMs use a hypervisor as the abstraction software.

Hypervisors in VMs

  • Hypervisor: Helps VMs emulate a physical computer.
  • Manages resource allocation between VMs on a single host.

Structure of VMs

  • Each VM runs its own operating system and has virtual hardware (CPU, storage).

Introduction to Docker

  • Docker: An open source platform for containerization.
  • Containers package applications and dependencies into portable units.

Docker's Approach

  • Docker containers virtualize the operating system, not the hardware.
  • Containers include the application, libraries, and dependencies.

Docker Components

  • Docker Engine: Manages the lifecycle of containers.
  • Handles container creation, running, and orchestration.
  • Interacts with the host kernel for resource allocation and isolation.

Resource Management in Docker

  • Uses cgroups (control groups) for resource allocation.
  • Namespaces for restricting container access and visibility on the system.

Docker Images

  • Standalone, executable packages containing software, runtime, libraries, and settings.
  • Built using Docker files, which are documents with image creation instructions.

Docker Containers

  • Instances of Docker images running in the Docker engine.
  • Isolated environments with necessary components for specific applications.

VMs and Hypervisors

  • Hypervisors come in two types: Type 1 (bare metal) and Type 2 (hosted).
  • Virtual hardware in VMs includes components like CPU, memory, and storage.

Guest Operating Systems in VMs

  • Each VM can have a different guest OS from the host and other VMs.

Use Cases for VMs

  • Running diverse operating systems.
  • Isolation: Each VM has a separate kernel and OS.
  • Legacy applications: Suitable for specific OS versions or configurations.

Use Cases for Docker Containers

  • Ideal for microservices-based applications.
  • Rapid development and deployment: Suited for agile and CI/CD practices.
  • Resource efficiency: Smaller footprint, allows more containers on the same hardware.

Selection Criteria

  • Choose based on application and infrastructure needs.
  • Hybrid environments: Legacy apps on VMs, modern apps in Docker containers.
  • Both technologies have transformed application deployment and management.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment