导航菜单

01 - Docker Fundamentals

Docker fundamentals

What is Docker?

Docker is an open-source container platform that packages apps and dependencies into portable containers that run anywhere Docker is supported. It uses Linux namespaces and cgroups for isolation.

Core components

1. Docker Engine

  • Daemon: background service on the host.
  • REST API: interface to the daemon.
  • Docker CLI: command-line client.

2. Docker Image

Read-only template with instructions to create containers. It can include OS, app code, dependencies, env vars, and config files.

3. Docker Container

Running instance of an image. Can be created/started/stopped/moved/removed. Containers are isolated, ensuring consistent runtime.

4. Docker Registry

Stores and distributes images. Docker Hub is common; orgs often run private registries.

Why Docker?

  1. Consistent environments: same behavior across dev/test/prod—no “works on my machine”.
  2. Fast deployment: spin containers quickly, shorten delivery.
  3. Isolation: containers avoid conflicts with others/host.
  4. Resource efficiency: share host kernel; lighter than VMs, faster startup.
  5. Versioning: images are versioned; easy rollback.
  6. Modularity & scale: microservice-friendly; easier scaling and maintenance.

Typical use cases

  1. Standardized dev envs: everyone codes inside the same container.
  2. CI/CD: plug into pipelines for automated test/deploy.
  3. Microservices: each service in its own container, scaled independently.
  4. Rapid prototyping: try stacks without local setup hassles.
  5. Cross-platform deploy: run on any Docker host—local, staging, cloud.

Summary

Docker tackles environment drift and deployment pain with containers, delivering consistency, faster rollout, better resource use, and modern architecture support. Next: install Docker, manage containers, and build custom images.

搜索