Docker: Up & Running: Shipping Reliable Containers in Production

Docker: Up & Running: Shipping Reliable Containers in Production

by Sean P. Kane, Karl Matthias

Paperback(2nd ed.)

$44.99 $49.99 Save 10% Current price is $44.99, Original price is $49.99. You Save 10%.
View All Available Formats & Editions
Choose Expedited Shipping at checkout for guaranteed delivery by Friday, September 20

Overview

Docker is rapidly changing the way organizations deploy software at scale. However, understanding how Linux containers fit into your workflow—and getting the integration details right—is not a trivial task. With the updated edition of 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.

This edition includes significant updates to the examples and explanations that reflect the substantial changes that have occurred over the past couple of years. Sean Kane and Karl Matthias have added a complete chapter on Docker Compose, deeper coverage of Docker Swarm mode, introductions to both Kubernetes and AWS Fargate, examples on how to optimize your Docker images, and much more.

  • 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 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: 9781492036739
Publisher: O'Reilly Media, Incorporated
Publication date: 10/06/2018
Edition description: 2nd ed.
Pages: 352
Sales rank: 742,981
Product dimensions: 6.90(w) x 9.10(h) x 0.80(d)

About the Author

Sean Kane is currently a Lead Site Reliability Engineer at New Relic. He has had a long career in production operations with many diverse roles across a broad range of industries. In addition to spending his spare time writing, teaching, and speaking about modern production operations, Sean is an avid traveller, hiker, and camper. He lives in the U.S. Pacific Northwest with his wife, children, and dog(s).

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.

Table of Contents

Foreword xi

Preface xv

1 Introduction 1

The Promise of Docker 1

Benefits of the Docker Workflow 3

What Docker Isn't 5

Important Terminology 7

Wrap-Up 7

2 The Docker Landscape 9

Process Simplification 9

Broad Support and Adoption 12

Architecture 14

Client/Server Model 14

Network Ports and Unix Sockets 15

Robust Tooling 15

Docker Command-Line Tool 16

Docker Engine API 16

Container Networking 17

Getting the Most from Docker 18

Containers Are Not Virtual Machines 19

Limited Isolation 20

Containers Are Lightweight 21

Toward an Immutable Infrastructure 21

Stateless Applications 22

Externalizing State 22

The Docker Workflow 23

Revision Control 24

Building 25

Testing 26

Packaging 27

Deploying 27

The Docker Ecosystem 27

Wrap-Up 30

3 Installing Docker 31

Docker Client 32

Linux 32

macOS, Mac OS X 34

Microsoft Windows 10 Professional 35

Docker Server 35

systemd-Based Linux 36

Non-Linux VM-Based Server 36

Testing the Setup 45

Ubuntu 45

Fedora 45

Alpine Linux 45

Exploring the Docker Server 46

Wrap-Up 48

4 Working with Docker Images 49

Anatomy of a Dockerfile 50

Building an Image 53

Troubleshooting Broken Builds 56

Running Your Image 58

Environment Variables 59

Custom Base Images 60

Storing Images 61

Public Registries 61

Private Registries 62

Authenticating to a Registry 62

Running a Private Registry 66

Advanced Building Techniques 70

Keeping Images Small 70

Layers Are Additive 77

Optimizing for the Cache 79

Wrap-Up 84

5 Working with Docker Containers 85

What Are Containers? 85

History of Containers 86

Creating a Container 87

Basic Configuration 88

Storage Volumes 92

Resource Quotas 95

Starting a Container 103

Auto-Restarting a Container 104

Stopping a Container 105

Killing a Container 107

Pausing and Unpausing a Container 107

Cleaning Up Containers and Images 108

Windows Containers 110

Wrap-Up 113

6 Exploring Docker 115

Printing the Docker Version 115

Server Information 117

Downloading Image Updates 118

Inspecting a Container 119

Exploring the Shell 121

Returning a Result 121

Getting Inside a Running Container 123

Docker exec 123

Nsenter 124

Docker volume 127

Logging 128

Docker logs 129

More Advanced Logging 131

Non-Plug-In Community Options 133

Monitoring Docker 134

Container Stats 134

Container Health Checks 138

Docker Events 141

cAdvisor 142

Prometheus Monitoring 146

Exploration 149

Wrap-Up 150

7 Debugging Containers 151

Process Output 152

Process Inspection 156

Controlling Processes 157

Network Inspection 160

Image History 163

Inspecting a Container 163

Filesystem Inspection 165

Wrap-Up 166

8 Exploring Docker Compose 167

Configuring Docker Compose 168

Launching Services 175

Exploring RocketChat 177

Exercising Docker Compose 185

Wrap-Up 188

9 The Path to Production Containers 189

Getting to Production 189

Docker's Role in Production Environments 190

Job Control 192

Resource Limits 193

Networking 193

Configuration 193

Packaging and Delivery 194

Logging 194

Monitoring 194

Scheduling 195

Service Discovery 197

Production Wrap-Up 199

Docker and the DevOps Pipeline 200

Quick Overview 200

Outside Dependencies 203

Wrap-Up 204

10 Docker at Scale 205

Centurion 206

Docker Swarm Mode 211

Amazon ECS and Fargate 221

Core AWS Setup 222

LAM Role Setup 222

AWS CLI Setup 223

Container Instances 225

Tasks 225

Testing the Task 233

Stopping the Task 233

Kubernetes 234

What Is Minikube? 235

Installing Minikube 235

Running Kubernetes 238

Kubernetes Dashboard 240

Kubernetes Containers and Pods 241

Let's Deploy Something 243

Deploying a Realistic Stack 245

Service Definition 246

PersistentVolumeClaim Definition 247

Deployment Definition 248

Deploying the Application 249

Scaling Up 251

Kubectl API 253

Wrap-Up 254

11 Advanced Topics 255

Containers in Detail 255

cgroups 256

Namespaces 260

Security 264

UID 0 265

Privileged Containers 268

Secure Computing Mode 271

SElinux and AppArmor 275

The Docker Daemon 276

Advanced Configuration 278

Networking 278

Storage 285

The Structure of Docker 289

Swapping Runtimes 293

gVisor 296

Wrap-Up 298

12 Container Platform Design 299

The Twelve-Factor App 300

Codebase 300

Dependencies 300

Config 302

Backing Services 304

Build, Release, Run 304

Processes 305

Port Binding 305

Concurrency 306

Disposability 306

Development/Production Parity 307

Logs 307

Admin Processes 308

Twelve-Factor Wrap-Up 308

The Reactive Manifesto 308

Responsive 309

Resilient 309

Elastic 309

Message-Driven 309

Wrap-Up 309

13 Conclusion 311

The Challenges Docker Addresses 311

The Docker Workflow 312

Minimizing Deployment Artifacts 313

Optimizing Storage and Retrieval 313

The Payoff 314

The Final Word 314

Index 317

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews