Docker: Up & Running, 3rd Edition

Book description

Docker and Linux containers have fundamentally changed the way that organizations develop, deliver, and run software at scale. But understanding why these tools are important and how they can be successfully integrated into your organization's ecosystem can be challenging. This fully updated guide provides developers, operators, architects, and technical managers with a thorough understanding of the Docker tool set and how containers can improve almost every aspect of modern software delivery and management.

This edition includes significant updates to the examples and explanations that reflect the substantial changes that have occurred since Docker was first released almost a decade ago. Sean Kane and Karl Matthias have updated the text to reflect best practices and to provide additional coverage of new features like BuildKit, multi-architecture image support, rootless containers, and much more.

  • Learn how Docker and Linux containers integrate with cloud services and Kubernetes
  • Experience building OCI images, plus deploying and managing Linux containers with powerful command-line tools
  • Understand how OCI images simplify dependency management and deployment workflow for your applications
  • Learn practical techniques for deploying and testing Linux containers in production
  • Deploy production containers at scale wherever you need them
  • Explore advanced Docker topics, including deployment tools, networking, orchestration, security, and configuration

Publisher resources

View/Submit Errata

Table of contents

  1. Foreword
  2. Preface
    1. Who Should Read This Book
    2. Why Read This Book?
    3. Navigating This Book
    4. Conventions Used in This Book
    5. Using Code Examples
    6. O’Reilly Online Learning
    7. How to Contact Us
    8. Acknowledgments
  3. 1. Introduction
    1. The Promise of Docker
      1. Benefits of the Docker Workflow
    2. What Docker Isn’t
    3. Important Terminology
    4. Wrap-Up
  4. 2. The Docker Landscape
    1. Process Simplification
    2. Broad Support and Adoption
    3. Architecture
      1. Client/Server Model
      2. Network Ports and Unix Sockets
      3. Robust Tooling
      4. Docker Command-Line Tool
      5. Docker Engine API
      6. Container Networking
    4. Getting the Most from Docker
      1. Containers Are Not Virtual Machines
      2. Limited Isolation
      3. Containers Are Lightweight
      4. Toward an Immutable Infrastructure
      5. Stateless Applications
      6. Externalizing State
    5. The Docker Workflow
      1. Revision Control
      2. Building
      3. Testing
      4. Packaging
      5. Deploying
      6. The Docker Ecosystem
    6. Wrap-Up
  5. 3. Installing Docker
    1. Docker Client
      1. Linux
      2. macOS, Mac OS X
      3. Microsoft Windows 11
    2. Docker Server
      1. systemd-Based Linux
      2. Non-Linux VM-Based Server
    3. Testing the Setup
      1. Ubuntu
      2. Fedora
      3. Alpine Linux
    4. Exploring the Docker Server
    5. Wrap-Up
  6. 4. Working with Docker Images
    1. Anatomy of a Dockerfile
    2. Building an Image
    3. Running Your Image
      1. Build Arguments
      2. Environment Variables as Configuration
    4. Custom Base Images
    5. Storing Images
      1. Public Registries
      2. Private Registries
      3. Authenticating to a Registry
      4. Running a Private Registry
    6. Optimizing Images
      1. Keeping Images Small
      2. Layers Are Additive
      3. Utilizing the Layer Cache
      4. Directory Caching
    7. Troubleshooting Broken Builds
      1. Debugging Pre-BuildKit Images
      2. Debugging BuildKit Images
    8. Multiarchitecture Builds
    9. Wrap-Up
  7. 5. Working with Containers
    1. What Are Containers?
      1. History of Containers
    2. Creating a Container
      1. Basic Configuration
      2. Storage Volumes
      3. Resource Quotas
    3. Starting a Container
    4. Auto-Restarting a Container
    5. Stopping a Container
    6. Killing a Container
    7. Pausing and Unpausing a Container
    8. Cleaning Up Containers and Images
    9. Windows Containers
    10. Wrap-Up
  8. 6. Exploring Docker
    1. Printing the Docker Version
    2. Server Information
    3. Downloading Image Updates
    4. Inspecting a Container
    5. Exploring the Shell
    6. Returning a Result
    7. Getting Inside a Running Container
      1. docker container exec
      2. docker volume
    8. Logging
      1. docker container logs
      2. More Advanced Logging
    9. Monitoring Docker
      1. Container Statistics
      2. Container Health Checks
      3. docker system events
      4. cAdvisor
    10. Prometheus Monitoring
    11. Exploration
    12. Wrap-Up
  9. 7. Debugging Containers
    1. Process Output
    2. Process Inspection
    3. Controlling Processes
    4. Network Inspection
    5. Image History
    6. Inspecting a Container
    7. Filesystem Inspection
    8. Wrap-Up
  10. 8. Exploring Docker Compose
    1. Configuring Docker Compose
    2. Launching Services
    3. Exploring Rocket.Chat
    4. Exercising Docker Compose
    5. Managing Configuration
      1. Default Values
      2. Mandatory Values
      3. The dotenv File
    6. Wrap-Up
  11. 9. The Path to Production Containers
    1. Getting to Production
    2. Docker’s Role in Production Environments
      1. Job Control
      2. Resource Limits
      3. Networking
      4. Configuration
      5. Packaging and Delivery
      6. Logging
      7. Monitoring
      8. Scheduling
      9. Service Discovery
      10. Production Wrap-Up
    3. Docker and the DevOps Pipeline
      1. Quick Overview
      2. Outside Dependencies
    4. Wrap-Up
  12. 10. Containers at Scale
    1. Docker Swarm Mode
    2. Kubernetes
      1. Minikube
      2. Docker Desktop-Integrated Kubernetes
      3. Kind
    3. Amazon ECS and Fargate
      1. Core AWS Setup
      2. IAM Role Setup
      3. AWS CLI Setup
      4. Container Instances
      5. Tasks
      6. Testing the Task
      7. Stopping the Task
    4. Wrap-Up
  13. 11. Advanced Topics
    1. Containers in Detail
      1. cgroups
      2. Namespaces
    2. Security
      1. UID 0
      2. Rootless Mode
      3. Privileged Containers
      4. Secure Computing Mode
      5. SELinux and AppArmor
      6. The Docker Daemon
    3. Advanced Configuration
      1. Networking
    4. Storage
    5. nsenter
      1. Debugging Shell-less Containers
    6. The Structure of Docker
    7. Swapping Runtimes
      1. gVisor
    8. Wrap-Up
  14. 12. The Expanding Landscape
    1. Client Tools
      1. nerdctl
      2. podman and buildah
    2. All-in-One Developer Tools
      1. Rancher Desktop
      2. Podman Desktop
    3. Wrap-Up
  15. 13. Container Platform Design
    1. The Twelve-Factor App
      1. Codebase
      2. Dependencies
      3. Config
      4. Backing Services
      5. Build, Release, Run
      6. Processes
      7. Port Binding
      8. Concurrency
      9. Disposability
      10. Development/Production Parity
      11. Logs
      12. Admin Processes
      13. Twelve-Factor Wrap-Up
    2. The Reactive Manifesto
      1. Responsive
      2. Resilient
      3. Elastic
      4. Message Driven
    3. Wrap-Up
  16. 14. Conclusion
    1. The Road Ahead
    2. The Challenges Docker Addresses
    3. The Docker Workflow
    4. Minimizing Deployment Artifacts
    5. Optimizing Storage and Retrieval
    6. The Payoff
    7. The Final Word
  17. Index
  18. About the Authors

Product information

  • Title: Docker: Up & Running, 3rd Edition
  • Author(s): Sean P. Kane, Karl Matthias
  • Release date: April 2023
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781098131821