Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Docker basic concepts

Docker basic concepts

What is containerization technology

Containers share the host kernel and are lightweight, isolated, and efficient, unlike virtual machines that require a full operating system. The figure below shows the basic architecture of a Docker container:

1. Pain points of traditional application deployment

In traditional application deployment, we often encounter the following problems:

2. Solutions provided by containerization technology

Containerization technology solves these problems in the following ways:

3. Core philosophy of containerization

Containerization follows the philosophy of 'immutable infrastructure':


Core concepts of Docker

1. Image

define: An image is a read-only template that contains everything needed to run an application: code, runtime, libraries, environment variables, and configuration files.

Feature:

An Analogy: An image is like an installer or a template; it defines everything needed to run the application but cannot be run directly.

2. Container

define: A container is a running instance of an image, a lightweight and portable execution environment.

Feature:

An Analogy: If an image is a class, then a container is an object instance. One image can create multiple containers, just as a class can create multiple objects.

3. Repository

define: A repository is a place for storing and distributing images and can contain multiple versions of an image.

Classification:

Registry vs Repository:


Differences between Docker and virtual machines

1. Architecture comparison

Feature Virtual machine Docker container
Isolation level Hardware-level virtualization Operating system-level virtualization
Operating system Each VM requires a full OS Shares the host OS kernel
Resource usage Heavyweight, consumes more resources Lightweight, consumes fewer resources
Startup time Minute level Second level
Performance overhead Larger Close to native performance
Image size GB level MB level

2. Container vs. virtual machine architecture

3. Comparison of use cases

Suitable scenarios for virtual machines:

Suitable scenarios for Docker containers:


Advantages and application scenarios of Docker

Main advantages

1. Environment consistency

2. Lightweight and efficient

3. Portability

4. Version control and rollback

5. Scalability

Typical use cases

1. Microservice architecture

2. CI/CD pipeline

3. Development environment standardization

4. Application modernization


Docker architecture components

Overall architecture diagram

Docker Client

Function:

Common Commands:

Docker Daemon

Function:

Main responsibilities:

Docker Engine

Component:

Workflow:

  1. The Client sends commands to the Daemon
  2. The Daemon parses and executes commands
  3. Interact with the Registry (if needed)
  4. Manage local images and containers
  5. Return results to the Client

Docker Registry

Purpose:

Features of Docker Hub:


The development history of Docker

Key milestones

Ecosystem development