Docker: Up & Running

Book description

Updated to cover Docker version 1.10



Docker is quickly changing the way that organizations are deploying software at scale. But understanding how Linux containers fit into your workflow—and getting the integration details right—are not trivial tasks. With this practical guide, you’ll learn how to use Docker to package your applications with all of their dependencies, and then test, ship, scale, and support your containers in production.

Two Lead Site Reliability Engineers at New Relic share much of what they have learned from using Docker in production since shortly after its initial release. Their goal is to help you reap the benefits of this technology while avoiding the many setbacks they experienced.

  • Learn how Docker simplifies dependency management and deployment workflow for your applications
  • Start working with Docker images, containers, and command line tools
  • Use practical techniques to deploy and test Docker-based Linux containers in production
  • Debug containers by understanding their composition and internal processes
  • Deploy production containers at scale inside your data center or cloud environment
  • 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. Safari® Books Online
    6. How to Contact Us
    7. Acknowledgments
  3. 1. Introduction
    1. The Birth of Docker
    2. The Promise of Docker
      1. Benefits of the Docker Workflow
    3. What Docker Isn’t
  4. 2. Docker at a Glance
    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. Application Programming Interface (API)
      6. Container Networking
    4. Getting the Most from Docker
      1. Containers Are Not Virtual Machines
      2. Containers Are Lightweight
      3. Towards an Immutable Infrastructure
      4. Limited Isolation
      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. Important Terminology
    2. Docker Client
      1. Linux
      2. Mac OS X 10.10
      3. Microsoft Windows 8
    3. Docker Server
      1. Systemd-Based Linux
      2. Upstart-Based Linux
      3. init.d-Based Linux
      4. Non-Linux VM-Based Server
    4. Test the Setup
      1. Ubuntu
      2. Fedora
      3. CentOS
    5. Wrap-Up
  6. 4. Working with Docker Images
    1. Anatomy of a Dockerfile
    2. Building an Image
    3. Running Your Image
      1. Environment Variables
    4. Custom Base Images
    5. Storing Images
      1. Public Registries
      2. Private Registries
      3. Authenticating to a Registry
      4. Mirroring a Registry
      5. Other Approaches to Image Delivery
  7. 5. Working with Docker 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. Next Steps
  8. 6. Exploring Docker
    1. Printing the Docker Version
    2. Server Information
    3. Downloading Image Updates
    4. Inspecting a Container
    5. Getting Inside a Running Container
      1. docker exec
      2. nsenter
    6. Exploring the Shell
    7. Returning a Result
    8. Docker Logs
    9. Monitoring Docker
      1. Container Stats
      2. Docker Events
      3. cAdvisor
    10. Exploration
  9. 7. The Path to Production Containers
    1. Deploying
      1. Classes of Tooling
      2. Orchestration Tools
      3. Distributed Schedulers
      4. Deployment Wrap-Up
    2. Testing Containers
      1. Quick Overview
      2. Outside Dependencies
  10. 8. 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. Moving Along
  11. 9. Docker at Scale
    1. Docker Swarm
    2. Centurion
    3. Amazon EC2 Container Service
      1. IAM Role Setup
      2. AWS CLI Setup
      3. Container Instances
      4. Tasks
      5. Testing the Task
      6. Stopping the Task
    4. Wrap-Up
  12. 10. Advanced Topics
    1. Pluggable Backends
      1. Execution Driver
      2. Storage
    2. Containers in Detail
      1. Control Groups (cgroups)
      2. Kernel Namespaces, User Namespaces
    3. Security
      1. How Secure Is Your Container?
      2. How Secure Is the Docker Daemon?
    4. Networking
  13. 11. Designing Your Production Container Platform
    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. In Summary
  14. 12. Conclusion
    1. The Challenges
    2. The Docker Workflow
    3. Minimizing Deployment Artifacts
    4. Optimizing Storage and Retrieval
    5. The Payoff
    6. The Final Word
  15. Index

Product information

  • Title: Docker: Up & Running
  • Author(s): Karl Matthias, Sean P. Kane
  • Release date: June 2015
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491917572