Docker: Up & Running: Shipping Reliable Containers in Production

Docker: Up & Running: Shipping Reliable Containers in Production

by Karl Matthias, Sean P. Kane

NOOK Book(eBook)

$16.99 $29.99 Save 43% Current price is $16.99, Original price is $29.99. You Save 43%.
View All Available Formats & Editions

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now

Overview

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

Product Details

ISBN-13: 9781491918517
Publisher: O'Reilly Media, Incorporated
Publication date: 06/11/2015
Sold by: Barnes & Noble
Format: NOOK Book
Pages: 232
Sales rank: 693,086
File size: 2 MB

About the Author

Karl Matthias is a Principal Systems Engineer with Nitro Software. He has worked as a developer, systems administrator, and network engineer for everything from startups to Fortune 500 companies. After a few years at startups in Germany and the UK followed by a stint at home in Portland, Oregon, he and his family recently landed in Dublin, Ireland. When not devoting his time to things digital, he can be found herding his two daughters, shooting film with vintage cameras, or riding one of his bicycles.


Sean Kane is currently a Lead Site Reliability Engineer for the Shared Infrastructure Team at New Relic. He has had a long career in production operations, with many diverse roles, in a broad range of industries. He has spoken about subjects like alerting fatigue and hardware automation at various meet-ups and technical conferences, including Velocity.Sean spent most of his youth living overseas, and exploring what life has to offer, including graduating from the Ringling Brother & Barnum & Bailey Clown College, completing 2 summer internships with the US Central Intelligence Agency, and building the very first web site in the state of Alaska. He gratefully lives in the US Pacific Northwest with his wife and children and still loves traveling and still photography.

Table of Contents

Foreword xi

Preface xv

1 Introduction 1

The Birth of Docker 1

The Promise of Docker 1

Benefits of the Docker Workflow 3

What Docker Isn't 5

2 Docker at a Glance 7

Process Simplification 7

Broad Support and Adoption 10

Architecture 10

Client/Server Model 10

Network Ports and Unix Sockets 11

Robust Tooling 12

Docker Command-Line Tool 12

Application Programming Interface (API) 13

Container Networking 13

Getting the Most from Docker 14

Containers Are Not Virtual Machines 15

Containers Are Lightweight 15

Towards an Immutable Infrastructure 16

Limited Isolation 16

Stateless Applications 17

Externalizing State 17

The Docker Workflow 18

Revision Control 18

Building 20

Testing 20

Packaging 21

Deploying 21

The Docker Ecosystem 22

Wrap-Up 23

3 Installing Docker 25

Important Terminology 25

Docker Client 26

Linux 27

Mac OS X 10.10 27

Microsoft Windows 8 29

Docker Server 29

Systerod-Based Linux 30

Upstart-Based Linux 30

Initd-Based Linux 30

Non-Linux VM-Based Server 31

Test the Setup 38

Ubuntu 39

Fedora 39

CentOS 39

Wrap-Up 39

4 Working with Docker Images 41

Anatomy of a Dockerfile 41

Building an Image 44

Running Your Image 49

Environment Variables 49

Custom Base Images 50

Storing Images 51

Public Registries 51

Private Registries 52

Authenticating to a Registry 52

Mirroring a Registry 54

Other Approaches to Image Delivery 57

5 Working with Docker Containers 59

What Are Containers? 59

History of Containers 60

Creating a Container 62

Basic Configuration 62

Storage Volumes 66

Resource Quotas 67

Starting a Container 73

Auto-Restarting a Container 74

Stopping a Container 74

Killing a Container 76

Pausing and Unpausing a Container 76

Cleaning Up Containers and Images 77

Next Steps 78

6 Exploring Docket 79

Printing the Docker Version 79

Server Information 80

Downloading Image Updates 81

Inspecting a Container 82

Getting Inside a Running Container 83

Docker exec 83

Nsenter 84

Exploring the Shell 87

Returning a Result 87

Docker Logs 89

Monitoring Docker 91

Container Stats 92

Docker Events 95

CAdvisor 96

Exploration 100

7 The Path to Production Containers 103

Deploying 103

Classes of Tooling 104

Orchestration Tools 105

Distributed Schedulers 106

Deployment Wrap-Up 107

Testing Containers 107

Quick Overview 108

Outside Dependencies 111

8 Debugging Containers 113

Process Output 113

Process Inspection 117

Controlling Processes 118

Network Inspection 119

Image History 120

Inspecting a Container 121

Filesystem Inspection 122

Moving Along 123

9 Docker at Scale 125

Docker Swarm 126

Centurion 130

Amazon EC2 Container Service 134

IAM Role Setup 135

AWSCLI Setup 136

Container Instances 137

Tasks 140

Testing the Task 145

Stopping the task 146

Wrap-Up 147

10 Advanced Topics 149

Pluggable Backends 149

Execution Drivers 149

Storage 153

Containers in Detail 156

Control Groups (cgroups) 156

Kernel Namespaces, User Namespaces 161

Security 164

How Secure Is Your Container? 164

How Secure Is the Docker Daemon? 170

Networking 171

11 Designing Your Production Container Platform 177

The Twelve-Factor App 178

Codebase 178

Dependencies 178

Config 181

Backing Services 182

Build, Release, Run 183

Processes 183

Port Binding 183

Concurrency 184

Disposability 184

Development/Production Parity 185

Logs 185

Admin Processes 186

Twelve-Factor Wrap-Up 186

The Reactive Manifesto 186

Responsive 187

Resilient 187

Elastic 187

Message Driven 187

In Summary 188

12 Conclusion 189

The Challenges 189

The Docker Workflow 190

Minimizing Deployment Artifacts 191

Optimizing Storage and Retrieval 191

The Payoff 192

The Final Word 192

Index 195

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews