You are previewing Using Docker.
O'Reilly logo
Using Docker

Book Description

Docker containers offer simpler, faster, and more robust methods for developing, distributing, and running software than previously available. With this hands-on guide, you’ll learn why containers are so important, what you’ll gain by adopting Docker, and how to make it part of your development process.

Table of Contents

  1. Preface
    1. Who Should Read This Book
    2. Why I Wrote This Book
    3. Navigating This Book
    4. Conventions Used in This Book
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
  2. I. Background and Basics
  3. 1. The What and Why of Containers
    1. Containers Versus VMs
    2. Docker and Containers
    3. Docker: A History
    4. Plugins and Plumbing
    5. 64-Bit Linux
  4. 2. Installation
    1. Installing Docker on Linux
      1. Run SELinux in Permissive Mode
      2. Running Without sudo
    2. Installing Docker on Mac OS or Windows
    3. A Quick Check
  5. 3. First Steps
    1. Running Your First Image
    2. The Basic Commands
    3. Building Images from Dockerfiles
    4. Working with Registries
      1. Private Repositories
    5. Using the Redis Official Image
    6. Conclusion
  6. 4. Docker Fundamentals
    1. The Docker Architecture
      1. Underlying Technologies
      2. Surrounding Technologies
      3. Docker Hosting
    2. How Images Get Built
      1. The Build Context
      2. Image Layers
      3. Caching
      4. Base Images
      5. Dockerfile Instructions
    3. Connecting Containers to the World
    4. Linking Containers
    5. Managing Data with Volumes and Data Containers
      1. Sharing Data
      2. Data Containers
    6. Common Docker Commands
      1. The run Command
      2. Managing Containers
      3. Docker Info
      4. Container Info
      5. Dealing with Images
      6. Using the Registry
    7. Conclusion
  7. II. The Software Lifecycle with Docker
  8. 5. Using Docker in Development
    1. Say “Hello World!”
    2. Automating with Compose
      1. The Compose Workflow
    3. Conclusion
  9. 6. Creating a Simple Web App
    1. Creating a Basic Web Page
    2. Taking Advantage of Existing Images
    3. Add Some Caching
    4. Microservices
    5. Conclusion
  10. 7. Image Distribution
    1. Image and Repository Naming
    2. The Docker Hub
    3. Automated Builds
    4. Private Distribution
      1. Running Your Own Registry
      2. Commerical Registries
    5. Reducing Image Size
    6. Image Provenance
      1. Conclusion
  11. 8. Continuous Integration and Testing with Docker
    1. Adding Unit Tests to Identidock
    2. Creating a Jenkins Container
      1. Triggering Builds
    3. Pushing the Image
      1. Responsible Tagging
      2. Staging and Production
      3. Image Sprawl
      4. Using Docker to Provision Jenkins Slaves
    4. Backing Up Jenkins
    5. Hosted CI Solutions
    6. Testing and Microservices
      1. Testing in Production
    7. Conclusion
  12. 9. Deploying Containers
    1. Provisioning Resources with Docker Machine
    2. Using a Proxy
    3. Execution Options
      1. Shell Scripts
      2. Using a Process Manager (or systemd to Rule Them All)
      3. Using a Configuration Management Tool
    4. Host Configuration
      1. Choosing an OS
      2. Choosing a Storage Driver
    5. Specialist Hosting Options
      1. Triton
      2. Google Container Engine
      3. Amazon EC2 Container Service
      4. Giant Swarm
    6. Persistent Data and Production Containers
    7. Sharing Secrets
      1. Saving Secrets in the Image
      2. Passing Secrets in Environment Variables
      3. Passing Secrets in Volumes
      4. Using a Key-Value Store
    8. Networking
    9. Production Registry
    10. Continuous Deployment/Delivery
    11. Conclusion
  13. 10. Logging and Monitoring
    1. Logging
      1. The Default Docker Logging
      2. Aggregating Logs
      3. Logging with ELK
      4. Docker Logging with syslog
      5. Grabbing Logs from File
    2. Monitoring and Alerting
      1. Monitoring with Docker Tools
      2. cAdvisor
      3. Cluster Solutions
    3. Commercial Monitoring and Logging Solutions
    4. Conclusion
  14. III. Tools and Techniques
  15. 11. Networking and Service Discovery
    1. Ambassadors
    2. Service Discovery
      1. etcd
      2. SkyDNS
      3. Consul
      4. Registration
      5. Other Solutions
    3. Networking Options
      1. Bridge
      2. Host
      3. Container
      4. None
    4. New Docker Networking
      1. Network Types and Plugins
    5. Networking Solutions
      1. Overlay
      2. Weave
      3. Flannel
      4. Project Calico
    6. Conclusion
  16. 12. Orchestration, Clustering, and Management
    1. Clustering and Orchestration Tools
      1. Swarm
      2. Fleet
      3. Kubernetes
      4. Mesos and Marathon
    2. Container Management Platforms
      1. Rancher
      2. Clocker
      3. Tutum
    3. Conclusion
  17. 13. Security and Limiting Containers
    1. Things to Worry About
    2. Defense-in-Depth
      1. Least Privilege
    3. Securing Identidock
    4. Segregate Containers by Host
    5. Applying Updates
      1. Avoid Unsupported Drivers
    6. Image Provenance
      1. Docker Digests
      2. Docker Content Trust
      3. Reproducible and Trustworthy Dockerfiles
    7. Security Tips
      1. Set a User
      2. Limit Container Networking
      3. Remove Setuid/Setgid Binaries
      4. Limit Memory
      5. Limit CPU
      6. Limit Restarts
      7. Limit Filesystems
      8. Limit Capabilities
      9. Apply Resource Limits (ulimits)
    8. Run a Hardened Kernel
    9. Linux Security Modules
      1. SELinux
      2. AppArmor
    10. Auditing
    11. Incident Response
    12. Future Features
    13. Conclusion
  18. Index