Docker

Topics

  • Virtualisation
  • Containers
  • Virtual machines vs Containers
  • Docker
  • Docker commands
  • Docker image

Virtualisation

  • Virtual machine - virtualise hardware

  • Container - virtualise operating system

Virtual Machine (Virtualisation)

Virtualise hardware for VM

Container (Virtualisation)

Virtualise OS (Linux) for container

Containers vs Virtual Machines

VMs vs Containers

Comparison: VMs vs Containers

VMs Containers
Heavyweight (full OS) Lightweight (shared os)
Run its own OS Share the host OS
Hardware virtualisation OS virtualisation
Long startup time Short startup time
Committed required memory Used as needed
Machine-level isolation (more secure) Process-level isolation (possibly less secure)

VMs : Advantage / Disanvantage

  • Advantages:

    • matured VM management and security tools
    • run multiple applications requiring different OSs on the same infrastructure
    • emulate an entire computing environment, including all OS resources
    • simplify the portability and migration between on-premises and cloud-based platforms
  • Disadvantages:

    • VM images are usually large, so it takes longer to backup or migrate between platforms
    • a physical server can support fewer VMs than containers
    • VM startup time can take some time (minutes)

Containers : Advantage / Disanvantage

  • Advantages:

    • more lightweight than VMs, images size in MBs rather than GBs
    • require fewer IT resources to deploy/run/manage
    • startup time is short (milliseconds)
    • a physical server can run more containers as compared to VMs
  • Disadvantages:

    • must run using the same OS as host
    • may be less secure than VMs since the underlying OS is shared

Containers

Isolated area of an OS with resource usage limits applied

In Linux, use kernel building blocks:

  • namespaces

    • partitions kernel resources such that one set of processes sees one set of resources while another set of processes sees a different set of resources
  • control group (or cgroups)

    • limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes

Docker With Linux Containers

Docker simplifies Linux container building blocks

Docker

Docker Architecture

Docker architecture

Docker Runtimes

Docker runtimes

Docker Installation

Container Life Cycle

Container life cycle

Docker Commands

  • all commands start with docker then followed by a subcommand
  • getting help
    • docker --help
  • get basic docker information
    • docker version
    • docker system info
  • common management commands
    • image
    • container
    • volume
    • network

Docker Image

Docker image

Docker Image when Run in Container

Docker image when run in container

References