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—are not trivial tasks. 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.
Significant changes to the examples and explanations in this second edition reflect massive changes that have occurred in this technology over the past couple of years. Site Reliability Engineers Sean P. Kane from New Relic and Karl Matthias from InVision share much of what they have learned from running Docker in production at scale.
In addition, this new release includes a full chapter on Docker Compose, deeper coverage of Docker Swarm Mode, an introduction to Kubernetes and AWS Fargate, advanced topics around building Docker images, directions for setting up a private Docker Registry, 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
Foreword |
|
xi | |
Preface |
|
xv | |
1 Introduction |
|
1 | (8) |
|
|
1 | (4) |
|
Benefits of the Docker Workflow |
|
|
3 | (2) |
|
|
5 | (2) |
|
|
7 | (1) |
|
|
7 | (2) |
2 The Docker Landscape |
|
9 | (22) |
|
|
9 | (3) |
|
Broad Support and Adoption |
|
|
12 | (2) |
|
|
14 | (4) |
|
|
14 | (1) |
|
Network Ports and Unix Sockets |
|
|
15 | (1) |
|
|
15 | (1) |
|
|
16 | (1) |
|
|
16 | (1) |
|
|
17 | (1) |
|
Getting the Most from Docker |
|
|
18 | (5) |
|
Containers Are Not Virtual Machines |
|
|
19 | (1) |
|
|
20 | (1) |
|
Containers Are Lightweight |
|
|
21 | (1) |
|
Toward an Immutable Infrastructure |
|
|
21 | (1) |
|
|
22 | (1) |
|
|
22 | (1) |
|
|
23 | (7) |
|
|
24 | (1) |
|
|
25 | (1) |
|
|
26 | (1) |
|
|
27 | (1) |
|
|
27 | (1) |
|
|
27 | (3) |
|
|
30 | (1) |
3 Installing Docker |
|
31 | (18) |
|
|
32 | (3) |
|
|
32 | (2) |
|
|
34 | (1) |
|
Microsoft Windows 10 Professional |
|
|
35 | (1) |
|
|
35 | (10) |
|
|
36 | (1) |
|
Non-Linux VM-Based Server |
|
|
36 | (9) |
|
|
45 | (1) |
|
|
45 | (1) |
|
|
45 | (1) |
|
|
45 | (1) |
|
Exploring the Docker Server |
|
|
46 | (2) |
|
|
48 | (1) |
4 Working with Docker Images |
|
49 | (36) |
|
|
50 | (3) |
|
|
53 | (3) |
|
Troubleshooting Broken Builds |
|
|
56 | (2) |
|
|
58 | (2) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
61 | (9) |
|
|
61 | (1) |
|
|
62 | (1) |
|
Authenticating to a Registry |
|
|
62 | (4) |
|
Running a Private Registry |
|
|
66 | (4) |
|
Advanced Building Techniques |
|
|
70 | (14) |
|
|
70 | (7) |
|
|
77 | (2) |
|
|
79 | (5) |
|
|
84 | (1) |
5 Working with Docker Containers |
|
85 | (30) |
|
|
85 | (2) |
|
|
86 | (1) |
|
|
87 | (16) |
|
|
88 | (4) |
|
|
92 | (3) |
|
|
95 | (8) |
|
|
103 | (1) |
|
Auto-Restarting a Container |
|
|
104 | (1) |
|
|
105 | (2) |
|
|
107 | (1) |
|
Pausing and Unpausing a Container |
|
|
107 | (1) |
|
Cleaning Up Containers and Images |
|
|
108 | (2) |
|
|
110 | (3) |
|
|
113 | (2) |
6 Exploring Docker |
|
115 | (36) |
|
Printing the Docker Version |
|
|
115 | (2) |
|
|
117 | (1) |
|
Downloading Image Updates |
|
|
118 | (1) |
|
|
119 | (2) |
|
|
121 | (1) |
|
|
121 | (2) |
|
Getting Inside a Running Container |
|
|
123 | (5) |
|
|
123 | (1) |
|
|
124 | (3) |
|
|
127 | (1) |
|
|
128 | (6) |
|
|
129 | (2) |
|
|
131 | (2) |
|
Non-Plug-In Community Options |
|
|
133 | (1) |
|
|
134 | (12) |
|
|
134 | (4) |
|
|
138 | (3) |
|
|
141 | (1) |
|
|
142 | (4) |
|
|
146 | (3) |
|
|
149 | (1) |
|
|
150 | (1) |
7 Debugging Containers |
|
151 | (16) |
|
|
152 | (4) |
|
|
156 | (1) |
|
|
157 | (3) |
|
|
160 | (3) |
|
|
163 | (1) |
|
|
163 | (2) |
|
|
165 | (1) |
|
|
166 | (1) |
8 Exploring Docker Compose |
|
167 | (22) |
|
Configuring Docker Compose |
|
|
168 | (7) |
|
|
175 | (2) |
|
|
177 | (8) |
|
Exercising Docker Compose |
|
|
185 | (3) |
|
|
188 | (1) |
9 The Path to Production Containers |
|
189 | (16) |
|
|
189 | (1) |
|
Docker's Role in Production Environments |
|
|
190 | (10) |
|
|
192 | (1) |
|
|
193 | (1) |
|
|
193 | (1) |
|
|
193 | (1) |
|
|
194 | (1) |
|
|
194 | (1) |
|
|
194 | (1) |
|
|
195 | (2) |
|
|
197 | (2) |
|
|
199 | (1) |
|
Docker and the DevOps Pipeline |
|
|
200 | (4) |
|
|
200 | (3) |
|
|
203 | (1) |
|
|
204 | (1) |
10 Docker at Scale |
|
205 | (50) |
|
|
206 | (5) |
|
|
211 | (10) |
|
|
221 | (13) |
|
|
222 | (1) |
|
|
222 | (1) |
|
|
223 | (2) |
|
|
225 | (1) |
|
|
225 | (8) |
|
|
233 | (1) |
|
|
233 | (1) |
|
|
234 | (20) |
|
|
235 | (1) |
|
|
235 | (3) |
|
|
238 | (2) |
|
|
240 | (1) |
|
Kubernetes Containers and Pods |
|
|
241 | (2) |
|
|
243 | (2) |
|
Deploying a Realistic Stack |
|
|
245 | (1) |
|
|
246 | (1) |
|
PersistentVolumeClaim Definition |
|
|
247 | (1) |
|
|
248 | (1) |
|
Deploying the Application |
|
|
249 | (2) |
|
|
251 | (2) |
|
|
253 | (1) |
|
|
254 | (1) |
11 Advanced Topics |
|
255 | (44) |
|
|
255 | (9) |
|
|
256 | (4) |
|
|
260 | (4) |
|
|
264 | (14) |
|
|
265 | (3) |
|
|
268 | (3) |
|
|
271 | (4) |
|
|
275 | (1) |
|
|
276 | (2) |
|
|
278 | (7) |
|
|
278 | (7) |
|
|
285 | (4) |
|
|
289 | (4) |
|
|
293 | (5) |
|
|
296 | (2) |
|
|
298 | (1) |
12 Container Platform Design |
|
299 | (12) |
|
|
300 | (8) |
|
|
300 | (1) |
|
|
300 | (2) |
|
|
302 | (2) |
|
|
304 | (1) |
|
|
304 | (1) |
|
|
305 | (1) |
|
|
305 | (1) |
|
|
306 | (1) |
|
|
306 | (1) |
|
Development/Production Parity |
|
|
307 | (1) |
|
|
307 | (1) |
|
|
308 | (1) |
|
|
308 | (1) |
|
|
308 | (1) |
|
|
309 | (1) |
|
|
309 | (1) |
|
|
309 | (1) |
|
|
309 | (1) |
|
|
309 | (2) |
13 Conclusion |
|
311 | (6) |
|
The Challenges Docker Addresses |
|
|
311 | (1) |
|
|
312 | (1) |
|
Minimizing Deployment Artifacts |
|
|
313 | (1) |
|
Optimizing Storage and Retrieval |
|
|
313 | (1) |
|
|
314 | (1) |
|
|
314 | (3) |
Index |
|
317 | |
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.