Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Containers

This section covers containerisation technologies and tools.

Overview

Containerisation is a method of packaging applications and their dependencies into isolated, lightweight units called containers. Unlike virtual machines, containers share the host system’s kernel, making them more resource-efficient and faster to start.

Why Containers?

  • Consistency: Run the same app in dev, staging, and production.
  • Isolation: Apps run in separate environments without interfering.
  • Portability: Move containers across environments or cloud providers with ease.
  • Scalability: Ideal for microservices and dynamic workloads.

Topics Covered

  • Conceptual understanding of containers
  • Docker as a container platform
  • Container orchestration tools (e.g., Docker Swarm, Kubernetes)
  • Best practices for working with containerised applications

Docker

Docker is a popular platform that simplifies building, running, and managing containers. It provides:

  • A standard format for container images
  • Tools for defining and managing container lifecycles
  • Support for networks, volumes, and multi-container apps

You’ll find Docker used widely in both development and production environments.

For detailed usage, syntax, and examples, see the dedicated Docker sections.

Kubernetes and Orchestration

As applications grow, managing containers manually becomes inefficient. Orchestration tools help automate:

  • Deployment
  • Scaling
  • Networking
  • Rolling updates and fault recovery

We cover:

  • Docker Swarm: A simple, native Docker orchestration system.
  • Kubernetes: A powerful, production-grade orchestration platform widely used in cloud-native environments.

Best Practices

When working with containers:

  • Use minimal base images (e.g., alpine) to reduce attack surface and size.
  • Separate concerns: One service per container.
  • Handle secrets securely — don’t bake credentials into images.
  • Scan images regularly for vulnerabilities.
  • Use orchestration for production workloads.
  • Clean up unused resources to avoid clutter and reclaim space.

Further Topics

  • Container registries (e.g., Docker Hub, GitHub Container Registry)
  • CI/CD (Continuous integration / Continuous Deployemet) pipelines with container integration
  • Comparing containers to virtual machines
  • Container security principles and tooling

Containers form the backbone of modern DevOps, microservices, and cloud-native architecture. Understanding them sets the stage for efficient, scalable, and reliable application delivery.